/bench.rb Secret
Created
February 28, 2023 21:26
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' | |
20.times do | |
p("%0.6f" % Benchmark.realtime { | |
File.open('A.txt').readlines do |line| | |
10.times do | |
line[5] | |
line[10] | |
line[20] | |
line[40] | |
line[60] | |
end | |
end | |
}) | |
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
jruby -Xcompile.invokedynamic gets_bench.rb | |
"0.757427" | |
"0.706870" | |
"0.775262" | |
"0.752200" | |
"0.638191" | |
"0.697848" | |
"0.840295" | |
"0.718880" | |
"0.775943" | |
"0.751087" | |
"0.861543" | |
"0.793738" | |
"0.731502" | |
"0.467162" | |
"0.724081" | |
"0.701253" | |
"0.768865" | |
"0.769979" | |
"0.662032" | |
"0.466345" | |
AFTER: | |
jruby -Xcompile.invokedynamic gets_bench.rb | |
"0.708550" | |
"0.586651" | |
"0.624988" | |
"0.587505" | |
"0.503620" | |
"0.515223" | |
"0.510485" | |
"0.765675" | |
"0.599085" | |
"0.606644" | |
"0.573161" | |
"0.413883" | |
"0.561218" | |
"0.597783" | |
"0.581685" | |
"0.576364" | |
"0.595542" | |
"0.340622" | |
"0.658417" | |
"0.704782" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment