The tree might get unbalanced depending on the order that routes are defined, for instance, a controller like this:
get "posts"
get "comments"
get "authors"
Will currently end up with a tree like this one:
posts
/
comments
/
authors
Which will not be optimal like this one:
comments
/ \
authors posts
I was talking with @sam and another thing that we could consider is getting static routes on a Hash and leave the tree with just dynamic stuff, but we might as well have a scenario like the above with dynamic routes.
I'll give a shot at implementing an AVL at insertion time to see how it goes.
The tree might get unbalanced depending on the order that routes are defined, for instance, a controller like this:
Will currently end up with a tree like this one:
Which will not be optimal like this one:
I was talking with @sam and another thing that we could consider is getting static routes on a
Hash
and leave the tree with just dynamic stuff, but we might as well have a scenario like the above with dynamic routes.I'll give a shot at implementing an AVL at insertion time to see how it goes.