ActiveSupport helpers done right
Add this line to your application's Gemfile:
gem 'faster_support'
And then execute:
$ bundle
Or install it yourself as:
$ gem install faster_support
Feature | Status |
---|---|
number_to_currency | |
number_to_delimited |
To run all suite of benchmarks use
bundle exec ruby benchmarks/all.rb
You can also run every test separately
bundle exec ruby benchmarks/number_to_currency/u_n_benchmark.rb
ActiveSupport#number_to_currency VS FasterSupport#number_to_currency_u_n
Checking for BigDecimal
Warming up --------------------------------------
ActiveSupport 874.000 i/100ms
FasterSupport 30.613k i/100ms
Calculating -------------------------------------
ActiveSupport 9.263k (± 5.2%) i/s - 46.322k in 5.015584s
FasterSupport 386.647k (± 2.9%) i/s - 1.959M in 5.071773s
Comparison:
FasterSupport: 386647.3 i/s
ActiveSupport: 9262.8 i/s - 41.74x slower
+---------------+-----------+----------+
| Memory | Allocated | Retained |
+---------------+-----------+----------+
| ActiveSupport | 1016800 | 0 |
| FasterSupport | 13200 | 0 |
+---------------+-----------+----------+
Sponsored by JetRockets.
Original idea by @romul and @Vankiru.
The gem is available as open source under the terms of the MIT License.