Skip to content

Instantly share code, notes, and snippets.

@kares
Created December 3, 2014 10:51
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 kares/b145d677c1faac646979 to your computer and use it in GitHub Desktop.
Save kares/b145d677c1faac646979 to your computer and use it in GitHub Desktop.
JRuby 1.7.16 benchmark for java.lang.System.getProperty
require 'benchmark'
TIMES = 10_000
Benchmark.bmbm do |x|
x.report("java.lang.System.get_property [#{TIMES}x]") do
TIMES.times do
java.lang.System.get_property('jars.skip') == 'true'
end
end
x.report("ENV_JAVA [#{TIMES}x]") do
TIMES.times do
ENV_JAVA['jars.skip'] == 'true'
end
end
end
Rehearsal --------------------------------------------------------------------------
java.lang.System.get_property [10000x] 0.130000 0.010000 0.140000 ( 0.063000)
ENV_JAVA [10000x] 0.020000 0.000000 0.020000 ( 0.014000)
----------------------------------------------------------------- total: 0.160000sec
user system total real
java.lang.System.get_property [10000x] 0.030000 0.000000 0.030000 ( 0.025000)
ENV_JAVA [10000x] 0.010000 0.000000 0.010000 ( 0.010000)
Rehearsal --------------------------------------------------------------------------
java.lang.System.get_property [10000x] 0.150000 0.000000 0.150000 ( 0.069000)
ENV_JAVA [10000x] 0.020000 0.000000 0.020000 ( 0.012000)
----------------------------------------------------------------- total: 0.170000sec
user system total real
java.lang.System.get_property [10000x] 0.030000 0.000000 0.030000 ( 0.019000)
ENV_JAVA [10000x] 0.000000 0.000000 0.000000 ( 0.007000)
Rehearsal --------------------------------------------------------------------------
ENV_JAVA [10000x] 0.110000 0.010000 0.120000 ( 0.047000)
java.lang.System.get_property [10000x] 0.060000 0.000000 0.060000 ( 0.035000)
----------------------------------------------------------------- total: 0.180000sec
user system total real
ENV_JAVA [10000x] 0.010000 0.000000 0.010000 ( 0.007000)
java.lang.System.get_property [10000x] 0.020000 0.000000 0.020000 ( 0.025000)
Rehearsal --------------------------------------------------------------------------
ENV_JAVA [10000x] 0.110000 0.000000 0.110000 ( 0.049000)
java.lang.System.get_property [10000x] 0.070000 0.010000 0.080000 ( 0.039000)
----------------------------------------------------------------- total: 0.190000sec
user system total real
ENV_JAVA [10000x] 0.010000 0.000000 0.010000 ( 0.007000)
java.lang.System.get_property [10000x] 0.020000 0.000000 0.020000 ( 0.017000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment