3 ms·
Iterating over your routes array on every lookup does not seem very efficient, seems like it would add quite a bit of overhead vs just a hash lookup. This lib
by johnnymonster 12y ago
Iterating over your routes array on every lookup does not seem very efficient, seems like it would add quite a bit of overhead vs just a hash lookup. This lib is so small its easy to see just how route look-ups are done. I've never really dug into any other router to see how route matching is done. I would assume a hash lookup would be the fastest?
- kolodny 12y agoCreating the hash would have the same overhead, at least this way we exit the loop when we find the correct entry. Of course if you needed to lookup more than one route in a single request then that may be an issue, but I really doubt that's the main use case