Fri 01 Jul 2022

Faster routing for Flask & Quart

Flask and Quart both utilise Werkzeug's HTTP router to route request paths to the relevant function. With the upcoming 2.2 release of Werkzeug this router will be significantly faster, with up to a factor of 5 seen in testing. This speedup increases with the size of the routing table and so you are likely to see further increases in your production applications. However, simple routing tables, as seen in micro-benchmarks, are unaffected and are unlikely to show a speedup.

The speedup is achieved by changing the algorithm from the original that matches against a list of regexs. Initially a radix/prefix tree algorithm was tried, but it couldn't support all of Werkzeug's features. Instead a state machine algorithm has been developed to be the new routing algorithm for Werkzeug.

Source: Faster routing for Flask & Quart, an article by Philip Jones.

The Lost City (2022)

A reclusive romance novelist on a book tour with her cover model gets swept up in a kidnapping attempt that lands them both in a cutthroat jungle adventure.

In the evening we watched The Lost City. I liked the movie and give it a 7 out of 10.