Created
June 29, 2018 04:18
-
-
Save havenwood/752d65a9bf2d3c176a711b6d5b848656 to your computer and use it in GitHub Desktop.
Pure Ruby SHA3 Benchmark
This file contains hidden or 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 'sha3-pure-ruby' | |
Benchmark.ips do |x| | |
x.report('SHA3') { Digest::SHA3.hexdigest 'chunky bacon' } | |
x.report('SHA3 224-bit') { Digest::SHA3.new(224).hexdigest 'chunky bacon' } | |
end |
This file contains hidden or 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-sha3-bench.rb | |
Warming up -------------------------------------- | |
SHA3 55.000 i/100ms | |
SHA3 224-bit 145.000 i/100ms | |
Calculating ------------------------------------- | |
SHA3 1.554k (± 5.5%) i/s - 7.755k in 5.005968s | |
SHA3 224-bit 1.603k (± 3.5%) i/s - 8.120k in 5.072603s |
This file contains hidden or 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-sha3-bench.rb | |
Warming up -------------------------------------- | |
SHA3 19.000 i/100ms | |
SHA3 224-bit 124.000 i/100ms | |
Calculating ------------------------------------- | |
SHA3 1.958k (±15.0%) i/s - 9.500k in 4.984945s | |
SHA3 224-bit 2.084k (± 6.0%) i/s - 10.416k in 5.023612s |
This file contains hidden or 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.105 (2.3.1 477d83b7 2018-05-28 6.0.0) [x86_64-darwin16.7.0] | |
~ ruby digest-sha3-bench.rb | |
Warming up -------------------------------------- | |
SHA3 16.000 i/100ms | |
SHA3 224-bit 17.000 i/100ms | |
Calculating ------------------------------------- | |
SHA3 181.939 (± 8.2%) i/s - 912.000 | |
SHA3 224-bit 179.404 (± 7.8%) i/s - 901.000 |
This file contains hidden or 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-sha3-bench.rb | |
Warming up -------------------------------------- | |
SHA3 120.000 i/100ms | |
SHA3 224-bit 121.000 i/100ms | |
Calculating ------------------------------------- | |
SHA3 1.194k (± 3.6%) i/s - 6.000k in 5.030669s | |
SHA3 224-bit 1.180k (± 3.5%) i/s - 5.929k in 5.030124s |
This file contains hidden or 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-rc2, like ruby 2.4.4, GraalVM CE Native [x86_64-darwin] | |
~ ruby digest-sha3-bench.rb | |
Warming up -------------------------------------- | |
SHA3 27.000 i/100ms | |
SHA3 224-bit 8.000 i/100ms | |
Calculating ------------------------------------- | |
SHA3 1.551k (±40.7%) i/s - 3.672k in 5.000406s | |
SHA3 224-bit 1.022k (±33.6%) i/s - 2.416k in 5.010459s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment