rails/rails — pull request #9155 by bogdan (2013-02-02 15:35:17+00:00)
Title: Rewrite Journey::Visitors::Formatter for performance

Current implementation of Formatter seem confusing - it reuses some code from base visitor. Just write it from scratch looks more readable, takes less lines of code and faster at the end.

Benchmark: https://gist.github.com/4697858
```
Running benchmark with current working tree
Checkout HEAD^
Running benchmark with HEAD^
Checkout to previous HEAD again

user system total real
------------------------------------------------draw routes
After patch: 0.290000 0.030000 0.320000 ( 0.324834)
Before patch: 0.310000 0.020000 0.330000 ( 0.324617)

----------------------------------------------inbox_path(1)
After patch: 0.010000 0.000000 0.010000 ( 0.008384)
Before patch: 0.010000 0.000000 0.010000 ( 0.008086)

---------------------------inbox_path(1, :format => "json")
After patch: 0.050000 0.000000 0.050000 ( 0.054178)
Before patch: 0.050000 0.000000 0.050000 ( 0.061162)
Improvement: 11%

---------------------inbox_message_path(inbox_id: 1, id: 2)
After patch: 0.060000 0.010000 0.070000 ( 0.056385)
Before patch: 0.070000 0.010000 0.080000 ( 0.064839)
Improvement: 13%

-------------------------------inbox_message_path(2, id: 1)
After patch: 0.060000 0.000000 0.060000 ( 0.063608)
Before patch: 0.060000 0.010000 0.070000 ( 0.071295)
Improvement: 11%

-------------------------------------book_path(10, "hello")
After patch: 0.010000 0.000000 0.010000 ( 0.009624)
Before patch: 0.000000 0.000000 0.000000 ( 0.009260)