rails/journey — pull request #38 by bogdan (2012-06-12 07:16:35+00:00)
Title: Formatter#generate: optimize parameters constraints code

Tried to optimize a way how router handles constraints.
During the process find out that constraints for optional parts doesn't work at all.
They are simply ignored. This doesn't sound well. This patch changes that test to a different behavior:
Constraints for optional parts are not ignored anymore.
As @tenderlove said: journey test suite in most cases just tests journey internal and we can change behavior in case it doesn't break actionpack test suite.

Also this patch offers 10% performance boost for named routes generation.
https://gist.github.com/2915825

```
Running benchmark with current working tree
Checkout HEAD^
Running benchmark with HEAD^
Checkout to previous HEAD again

user system total real
--------------------------------------generate without name
After patch: 0.340000 0.010000 0.350000 ( 0.349404)
Before patch: 0.320000 0.030000 0.350000 ( 0.356459)
Improvement: 2%

-----------------------------------------generate with name
After patch: 0.040000 0.000000 0.040000 ( 0.033736)
Before patch: 0.040000 0.000000 0.040000 ( 0.037829)
Improvement: 11%

-------------------------------------generate with globbing
After patch: 0.330000 0.000000 0.330000 ( 0.340345)
Before patch: 0.330000 0.020000 0.350000 ( 0.350696)
Improvement: 3%
```