Created
July 3, 2018 21:16
-
-
Save havenwood/f04f99a3050d17ae0cd152f6c86fcf8a to your computer and use it in GitHub Desktop.
Pure Ruby xxHash Benchmark
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
# frozen_string_literal: true | |
require 'benchmark/ips' | |
require 'ruby-xxhash' | |
Benchmark.ips do |x| | |
text = 'chunky bacon' | |
seed = 12345 | |
x.report('xxHash32') { XXhash.xxh32 text, seed } | |
x.report('xxHash64') { XXhash.xxh32 text, seed } | |
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
~ ruby -v | |
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 Java HotSpot(TM) 64-Bit Server VM 10.0.1+10 on 10.0.1+10 +jit [darwin-x86_64] | |
~ ruby -Xcompile.invokedynamic digest-xxhash-bench.rb | |
Warming up -------------------------------------- | |
xxHash32 18.250k i/100ms | |
xxHash64 51.709k i/100ms | |
Calculating ------------------------------------- | |
xxHash32 706.755k (± 5.6%) i/s - 3.522M in 5.000595s | |
xxHash64 717.427k (± 3.0%) i/s - 3.620M in 5.050095s |
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
~ ruby -v | |
jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 GraalVM 1.0.0-rc1 25.71-b01-internal-jvmci-0.42 on 1.8.0_161-b12 +jit [darwin-x86_64] | |
~ ruby -Xcompile.invokedynamic -Xfixnum.cache=false digest-xxhash-bench.rb | |
Warming up -------------------------------------- | |
xxHash32 10.986k i/100ms | |
xxHash64 55.246k i/100ms | |
Calculating ------------------------------------- | |
xxHash32 950.237k (± 9.8%) i/s - 4.702M in 5.002677s | |
xxHash64 947.486k (± 5.9%) i/s - 4.751M in 5.038389s |
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
~ ruby -v | |
rubinius 3.104 (2.3.1 eced203d 2018-05-15 4.0.1) [x86_64-darwin17.5.0] | |
~ ruby digest-xxhash-bench.rb | |
Warming up -------------------------------------- | |
xxHash32 3.842k i/100ms | |
xxHash64 4.019k i/100ms | |
Calculating ------------------------------------- | |
xxHash32 45.204k (± 8.1%) i/s - 226.678k | |
xxHash64 45.229k (± 7.5%) i/s - 225.064k |
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
~ ruby -v | |
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin17] | |
~ ruby digest-xxhash-bench.rb | |
Warming up -------------------------------------- | |
xxHash32 14.993k i/100ms | |
xxHash64 15.018k i/100ms | |
Calculating ------------------------------------- | |
xxHash32 164.490k (± 2.3%) i/s - 824.615k in 5.015916s | |
xxHash64 164.180k (± 2.8%) i/s - 825.990k in 5.035278sx |
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
~ ruby -v | |
truffleruby 1.0.0-rc3, like ruby 2.4.4, GraalVM CE Native [x86_64-darwin] | |
~ ruby digest-xxhash-bench.rb | |
Warming up -------------------------------------- | |
xxHash32 86.879k i/100ms | |
xxHash64 86.938k i/100ms | |
Calculating ------------------------------------- | |
xxHash32 1.187M (±20.3%) i/s - 5.647M in 5.077543s | |
xxHash64 1.175M (±15.7%) i/s - 5.738M in 5.063060s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment