Last active
April 18, 2018 18:31
-
-
Save skord/c6d899ea5fbadba2acb2d4f67e8f2b0d to your computer and use it in GitHub Desktop.
MRI 2.5.1 vs jruby 9.1.16.0 vs truffleruby
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
require 'benchmark/ips' | |
require 'erb' | |
template = <<TEMPLATE | |
<html> | |
<head> <%= title %> </head> | |
<body> | |
<h1> <%= title %> </h1> | |
<p> | |
<%= content %> | |
</p> | |
</body> | |
</html> | |
TEMPLATE | |
title = "hello world!" | |
content = "hello world!\n" * 10 | |
src = "def self.render(title, content); #{ERB.new(template).src}; end" | |
mod = Module.new | |
mod.instance_eval(src, "(ERB)") | |
Benchmark.ips do |x| | |
x.iterations = 3 | |
x.report("erb") { mod.render(title, content) } | |
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
mike@beast ~/rubybench rbenv shell 2.5.1 | |
mike@beast ~/rubybench ruby benchmark.rb | |
Warming up -------------------------------------- | |
erb 100.921k i/100ms | |
erb 104.947k i/100ms | |
erb 102.489k i/100ms | |
Calculating ------------------------------------- | |
erb 1.264M (± 3.3%) i/s - 6.354M in 5.032608s | |
erb 1.223M (± 4.5%) i/s - 6.149M in 5.040216s | |
erb 1.232M (± 6.8%) i/s - 6.149M in 5.018345s | |
mike@beast ~/rubybench rbenv shell truffleruby | |
mike@beast ~/rubybench ruby benchmark.rb | |
Warming up -------------------------------------- | |
erb 1.405M i/100ms | |
erb 1.317M i/100ms | |
erb 1.460M i/100ms | |
Calculating ------------------------------------- | |
erb 300.964M (± 8.8%) i/s - 1.317B in 4.999496s | |
erb 300.459M (± 4.5%) i/s - 1.498B in 5.001161s | |
erb 294.071M (± 6.0%) i/s - 1.463B in 4.998085s | |
mike@beast ~/rubybench rbenv shell jruby-9.1.16.0 | |
mike@beast ~/rubybench ruby benchmark.rb | |
Warming up -------------------------------------- | |
erb 68.880k i/100ms | |
erb 76.248k i/100ms | |
erb 76.006k i/100ms | |
Calculating ------------------------------------- | |
erb 970.229k (± 6.1%) i/s - 4.864M in 5.034909s | |
erb 909.808k (± 6.6%) i/s - 4.560M in 5.038176s | |
erb 984.030k (± 5.7%) i/s - 4.940M in 5.039935s | |
mike@beast ~/rubybench | |
mike@beast ~/rubybench rbenv shell 2.4.4 | |
mike@beast ~/rubybench ruby benchmark.rb | |
Warming up -------------------------------------- | |
erb 47.567k i/100ms | |
erb 47.621k i/100ms | |
erb 48.560k i/100ms | |
Calculating ------------------------------------- | |
erb 529.965k (± 2.3%) i/s - 2.671M in 5.042356s | |
erb 539.659k (± 1.0%) i/s - 2.719M in 5.039594s | |
erb 533.759k (± 2.9%) i/s - 2.719M in 5.099428s |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment