diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-26 15:09:18 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-26 15:09:18 -0800 |
commit | 707dfcdbc36c48af3411b9de08d70757ee4e612f (patch) | |
tree | 4d727e77f5e62f72a8f5d9596b29fdcb086eeca1 /railties/lib/rails/generators/resource_helpers.rb | |
parent | fea1cdcff4d50d302d8e8532432c3ab107ff816d (diff) | |
download | rails-707dfcdbc36c48af3411b9de08d70757ee4e612f.tar.gz rails-707dfcdbc36c48af3411b9de08d70757ee4e612f.tar.bz2 rails-707dfcdbc36c48af3411b9de08d70757ee4e612f.zip |
speed up `underscore` in cases that don't need to do anything
Benchmark:
Benchmark.ips do |x|
x.report("home") { "home".underscore }
x.report("Home") { "Home".underscore }
x.report("homeBase") { "homeBase".underscore }
x.report("home::base") { "home::base".underscore }
end
Before:
Calculating -------------------------------------
home 2598 i/100ms
Home 2463 i/100ms
homeBase 2300 i/100ms
home::base 2086 i/100ms
-------------------------------------------------
home 28522.3 (±14.7%) i/s - 140292 in 5.065102s
Home 29165.8 (±14.9%) i/s - 140391 in 5.000475s
homeBase 26218.5 (±7.1%) i/s - 131100 in 5.030485s
home::base 27712.3 (±5.9%) i/s - 139762 in 5.064077s
After:
Calculating -------------------------------------
home 23163 i/100ms
Home 2432 i/100ms
homeBase 2160 i/100ms
home::base 2265 i/100ms
-------------------------------------------------
home 1501614.8 (±10.2%) i/s - 7412160 in 5.009540s
Home 28754.0 (±8.5%) i/s - 143488 in 5.033886s
homeBase 25331.1 (±5.6%) i/s - 127440 in 5.047940s
home::base 27089.9 (±5.5%) i/s - 135900 in 5.033516s
Diffstat (limited to 'railties/lib/rails/generators/resource_helpers.rb')
0 files changed, 0 insertions, 0 deletions