Created
March 9, 2018 01:49
-
-
Save yuki24/22ef958c961a3640b04c147bd003e9f5 to your computer and use it in GitHub Desktop.
`ruby bench.rb`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark_driver' | |
Benchmark.driver do |x| | |
x.prelude <<~RUBY | |
METHODS = ''.methods | |
INPUT = 'start_with?' | |
spell_checker = DidYouMean::SpellChecker.new(dictionary: METHODS) | |
RUBY | |
x.report 'spell check', %{ spell_checker.correct(INPUT) } | |
x.loop_count 10_000 | |
x.verbose | |
x.rbenv( | |
'2.3.6', | |
'2.4.3', | |
'2.5.0', | |
'2.6.0-dev', | |
'2.6.0-dev,--jit', | |
) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2.3.6: ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-darwin17] | |
2.4.3: ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin17] | |
2.5.0: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] | |
2.6.0-dev: ruby 2.6.0dev (2018-03-07 trunk 62693) [x86_64-darwin17] | |
2.6.0-dev,--jit: ruby 2.6.0dev (2018-03-07 trunk 62693) +JIT [x86_64-darwin17] | |
Calculating ------------------------------------- | |
2.3.6 2.4.3 2.5.0 2.6.0-dev 2.6.0-dev,--jit | |
spell check 962.002 920.626 817.009 838.779 630.131 i/s - 10.000k times in 10.394994s 10.862173s 12.239773s 11.922096s 15.869706s | |
Comparison: | |
spell check | |
2.3.6: 962.0 i/s | |
2.4.3: 920.6 i/s - 1.04x slower | |
2.6.0-dev: 838.8 i/s - 1.15x slower | |
2.5.0: 817.0 i/s - 1.18x slower | |
2.6.0-dev,--jit: 630.1 i/s - 1.53x slower |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment