sam/harbor — Issue #43: Optimize router tree
Author: fgrehm
Created: 2012-03-08 04:41:00+00:00
State: open

The tree might get unbalanced depending on the order that routes are defined, for instance, a controller like this:

```ruby
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](http://en.wikipedia.org/wiki/AVL_tree) at insertion time to see how it goes.