You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The 'uuid' gem uses a state file to maintain some global sequencing. However when using this file under JRuby, performance is severely impacted. It seems like the problem is its repeated reopening of the file for every UUID generated.
Benchmark:
require 'uuid'
(ARGV[0] || 5).to_i.times do
Benchmark.bm(20) do |bm|
bm.report("default") do
uuid = UUID.new
100_000.times { uuid.generate }
end
bm.report("default, no state file") do
old_state_file = UUID.state_file
UUID.state_file = false
uuid = UUID.new
100_000.times { uuid.generate }
UUID.state_file = old_state_file
end
end
end
Numbers:
system ~/projects/jruby/tmp/uuid $ jruby -Ilib bench_uuid.rb
user system total real
default 10.610000 3.870000 14.480000 ( 9.157000)
default, no state file 1.390000 0.370000 1.760000 ( 0.767000)
user system total real
default 4.420000 3.660000 8.080000 ( 6.886000)
default, no state file 0.370000 0.000000 0.370000 ( 0.352000)
user system total real
default 3.990000 3.610000 7.600000 ( 6.723000)
default, no state file 0.400000 0.000000 0.400000 ( 0.349000)
user system total real
default 3.540000 3.550000 7.090000 ( 6.580000)
default, no state file 0.380000 0.000000 0.380000 ( 0.339000)
user system total real
default 3.520000 3.510000 7.030000 ( 6.551000)
default, no state file 0.350000 0.000000 0.350000 ( 0.328000)
system ~/projects/jruby/tmp/uuid $ rvm 1.9.3 do ruby -Ilib bench_uuid.rb
user system total real
default 0.740000 0.010000 0.750000 ( 0.736922)
default, no state file 0.730000 0.000000 0.740000 ( 0.759890)
user system total real
default 0.730000 0.000000 0.730000 ( 0.734763)
default, no state file 0.730000 0.010000 0.740000 ( 0.727520)
user system total real
default 0.730000 0.000000 0.730000 ( 0.734713)
default, no state file 0.760000 0.000000 0.760000 ( 0.755858)
user system total real
default 0.750000 0.000000 0.750000 ( 0.759376)
default, no state file 0.730000 0.000000 0.730000 ( 0.730918)
user system total real
default 0.730000 0.010000 0.740000 ( 0.730651)
default, no state file 0.730000 0.000000 0.730000 ( 0.726645)
The text was updated successfully, but these errors were encountered:
Works for me on MacOS.
I guess that was fixed from #4393.
My env:
$ jruby -v
jruby 9.1.8.0-SNAPSHOT (2.3.1) 2017-01-15 3e4fd9e Java HotSpot(TM) 64-Bit Server VM 25.101-b13 on 1.8.0_101-b13 +jit [darwin-x86_64]
Numbers:
$ jruby -Ilib bench_uuid.rb
user system total real
default 5.050000 0.100000 5.150000 ( 1.885882)
default, no state file 2.060000 0.040000 9.060000 ( 3.626896)
user system total real
default 0.290000 0.010000 0.300000 ( 0.301836)
default, no state file 0.410000 0.020000 0.430000 ( 0.335635)
user system total real
default 0.300000 0.000000 0.300000 ( 0.282258)
default, no state file 1.370000 0.040000 1.410000 ( 0.697191)
user system total real
default 0.290000 0.010000 0.300000 ( 0.286831)
default, no state file 0.380000 0.010000 0.390000 ( 0.308904)
user system total real
default 0.280000 0.000000 0.280000 ( 0.281324)
default, no state file 0.390000 0.010000 0.400000 ( 0.329983)
$ rvm jruby-9.1.7.0 do ruby -Ilib bench_uuid.rb
user system total real
default 12.480000 13.160000 25.640000 ( 21.828986)
default, no state file 2.190000 0.030000 9.920000 ( 3.741480)
user system total real
default 4.600000 5.280000 9.880000 ( 12.094271)
default, no state file 0.420000 0.000000 0.420000 ( 0.326450)
user system total real
default 3.810000 5.210000 9.020000 ( 11.751834)
default, no state file 0.370000 0.000000 0.370000 ( 0.321610)
user system total real
default 3.240000 5.260000 8.500000 ( 12.087594)
default, no state file 0.690000 0.010000 0.700000 ( 0.366765)
user system total real
default 3.130000 5.190000 8.320000 ( 11.753569)
default, no state file 0.360000 0.010000 0.370000 ( 0.324683)
From http://jira.codehaus.org/browse/JRUBY-6841
The 'uuid' gem uses a state file to maintain some global sequencing. However when using this file under JRuby, performance is severely impacted. It seems like the problem is its repeated reopening of the file for every UUID generated.
Benchmark:
Numbers:
The text was updated successfully, but these errors were encountered: