diff options
author | Jean Boussier <jean.boussier@gmail.com> | 2015-08-17 18:44:51 -0400 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2015-08-17 18:44:51 -0400 |
commit | a94c2e1f23c4216a5b854c13f439882311fda461 (patch) | |
tree | 6ff7cb788d4686e29901ded66678e86b81e06629 /activesupport/lib/active_support/testing/autorun.rb | |
parent | 8d7b883f33034732996f80f73f46d050c7dc9210 (diff) | |
download | rails-a94c2e1f23c4216a5b854c13f439882311fda461.tar.gz rails-a94c2e1f23c4216a5b854c13f439882311fda461.tar.bz2 rails-a94c2e1f23c4216a5b854c13f439882311fda461.zip |
Use == 0 instead of .zero? in #try
The perf gain is relatively minor but consistent:
```
Calculating -------------------------------------
0.zero? 137.091k i/100ms
1.zero? 137.350k i/100ms
0 == 0 142.207k i/100ms
1 == 0 144.724k i/100ms
-------------------------------------------------
0.zero? 8.893M (± 6.5%) i/s - 44.280M
1.zero? 8.751M (± 6.4%) i/s - 43.677M
0 == 0 10.033M (± 7.0%) i/s - 49.915M
1 == 0 9.814M (± 8.0%) i/s - 48.772M
```
And try! is quite a big hotspot for us so every little gain is appreciable.
Diffstat (limited to 'activesupport/lib/active_support/testing/autorun.rb')
0 files changed, 0 insertions, 0 deletions