Skip to content

Instantly share code, notes, and snippets.

@eregon
Last active June 16, 2020 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eregon/3879ea046a1d35b565351e82326d936b to your computer and use it in GitHub Desktop.
Save eregon/3879ea046a1d35b565351e82326d936b to your computer and use it in GitHub Desktop.
I added `x.compare!` in bin/benchmark
$ cd ext
$ rake
$ cd ..
$ gem install ffi-compiler benchmark-ips
$ ruby -Ilib bin/benchmark
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
Warming up --------------------------------------
fastrandom 650.342k i/100ms
random 2.097M i/100ms
Calculating -------------------------------------
fastrandom 6.457M (± 0.3%) i/s - 32.517M in 5.036296s
random 21.182M (± 2.4%) i/s - 106.960M in 5.052525s
Comparison:
random: 21181651.6 i/s
fastrandom: 6456620.6 i/s - 3.28x (± 0.00) slower
jruby 9.2.11.1 (2.5.7) 2020-03-25 b1f55b1a40 OpenJDK 64-Bit Server VM 25.242-b08 on 1.8.0_242-b08 +jit [linux-x86_64]
Warming up --------------------------------------
fastrandom 360.894k i/100ms
random 595.531k i/100ms
Calculating -------------------------------------
fastrandom 8.899M (±22.9%) i/s - 40.420M in 5.020191s
random 19.104M (±27.3%) i/s - 78.610M in 5.000620s
Comparison:
random: 19104461.1 i/s
fastrandom: 8898941.6 i/s - 2.15x (± 0.00) slower
truffleruby 20.2.0-dev-725fea94, like ruby 2.6.6, GraalVM CE JVM [x86_64-linux]
Warming up --------------------------------------
fastrandom 823.982k i/100ms
random 4.904M i/100ms
Calculating -------------------------------------
fastrandom 8.226M (± 1.4%) i/s - 41.199M in 5.009269s
random 49.811M (± 0.8%) i/s - 250.124M in 5.021797s
Comparison:
random: 49810558.8 i/s
fastrandom: 8226275.9 i/s - 6.06x (± 0.00) slower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment