No such tree SHA1 was found

Copyright 2008, Oleg Andreev oleganza@gmail.com
MIT License.

README

FastRouting is an idea of building ruby if/elsif/else code
to match user-friendly URIs routing.

Run specs with (RSpec 1.1.1):

$ spec spec

Run benchmarks:

$ ruby benchmarks/actionpack_comparison.rb

GOAL

The goal is to provide ActionPack with very-very fast routing.
This could be a pluggable patch or a real port into
the heart of ActionController.

Some things are not ready yet.

TODO

0) DONE! Compare with ActionPack performance.
1) (WONTFIX) Not all of the standard Drawer options supported yet

     (like methods for resources, singleton resources and so on)

2) DONE! Dangerous assumption: simple Hash/Array/String objects are passed as options

     to routes map. We currently generate code for them with Object#inspect
     This can be fixed with a fat array of references.   
     (That's exactly done with @all_options)  

3) DONE! “rest” and “/prefix/rest” patterns are not supported yet.
4) DONE! “” (empty route) support
5) DONE! requirements for params: map.connect ‘blog/:yyyy/:mm/:dd’, :yyyy => /^\d{4}$/, :mm => /^\d\d$/, :dd => /^\d\d$/
6) DONE! Mime types: /:segment.:extension
7) DONE! Set default params (:action, :controller)
8) DONE! http method based recognition strongly needed (as a last level branch, maybe)
9) DONE! :requirements => {…} support (one more options level)
0) Pending. requirements for same-called :params in different rules
1) Pending. specs for requirements to *rest (experimental!)
2) DONE! default requirement for :id
3) :defaults => { } for ending segments

TODO FOR OPTIMIZATION

1) Flatten tails of ‘else raise … else raise …’ (doesn’t have signifact impact anyway)
2) Do not do seg = segments[level]; if there is only one branch
3) Convert controller names into controller constants for faster
retrieval in runtime.
4) Try hash[segments[level]] instead of if segm == ‘some string’
UPD. Tried that, doesn’t work better.

AUTHOR