josevalim/ex_bridge — pull request #4 by jeroenvandijk (2011-10-29 13:01:48+00:00)
Title: Use pattern matching instead of route lookup

I thought it would be faster to use pattern matching instead of iterating over the available routes. So instead of adding routes as list entries, I'm adding routes as dynamically generated functions that can be pattern matched by the compiler.

This pull request isn't complete yet (no splats and parameter matching), two tests fail and an ab benchmark doesn't tell me I have greatly improved speed in the case of many routes. Intuitively I would think though that this should be a lot faster for many routes.

Maybe this patch will only make things faster when you compile to native code, I'm guessing here.

What do you think?