If I have the routes /foo/bar and /foo/bar/(\d+) I can generate the regexp ((^\/foo\/bar$)|(^\/foo\/bar\/\d+$))
I'm not at all surprised, the quality of software in node is pretty low, I've seen numerous issues in node libs being just as boneheaded. I swear, the fact that the express devs overlooked a key optimization is crazy. Rails, by way of example, uses the Journey engine to solve this problem (https://github.com/rails/journey)
The code referred to in that presentation is the rails router, journey - https://github.com/rails/journey
router.lua is much simpler than that. Journey can parse complex regular expressions like `/(app|application)/(:id)+/foo` while router.lua can only handle parameter interpolations (like `/app/:app_id/foo`). We found out that handling parameters was enough for us.
That said, the strategy we use is pretty similar: we parse the routes and transform them into a tree, which then allows us to match urls faster. It's just that our string parsing and tree construction are much, much simpler than Journey's.
Inept? Kids these days. Forking my code then calling me inept. It's precious is what it is.
But you're moving the goal-posts. You said read the source. Since you're clearly unfamiliar with it, here's a couple handy links to the Routing code I mentioned.
https://github.com/rails/rails/blob/master/actionpack/lib/ac...
https://github.com/rails/journey
> it's complete voodoo to make side effects of editing a file default
You seem to be under the impression Rails doesn't have any facilities to reload files after modification.
Great talk, also.