tempfile.rb sucks in JRuby
--------------------------
Key: JRUBY-3307
URL: http://jira.codehaus.org/browse/JRUBY-3307
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1.6
Reporter: Thomas E Enebo
Assignee: Thomas E Enebo
Fix For: JRuby 1.1.7
Based on really poor assumptions about garbage collection, the default (MRI)
implementation of tempfile.rb is really bad in JRuby (and not so hot in MRI to
tell the truth). Here is a simple run of bench/bench_tempfile.rb to show how
well we do just creating tempfile objects:
{noformat}
ruby bench/bench_tempfile.rb
10k Tempfile.open(file)
0.460000 0.440000 0.900000 ( 0.940749)
0.460000 0.440000 0.900000 ( 0.950805)
0.470000 0.440000 0.910000 ( 0.941242)
0.460000 0.430000 0.890000 ( 0.922238)
0.470000 0.440000 0.910000 ( 0.931321)
0.460000 0.440000 0.900000 ( 0.921005)
0.460000 0.430000 0.890000 ( 0.924353)
0.470000 0.440000 0.910000 ( 0.938983)
0.460000 0.440000 0.900000 ( 0.931108)
0.480000 0.470000 0.950000 ( 1.027533)
jr --server bench/bench_tempfile.rb
10k Tempfile.open(file)
9.422000 0.000000 9.422000 ( 9.421392)
54.812000 0.000000 54.812000 ( 54.812113)
157.798000 0.000000 157.798000 (157.798209)
329.697000 0.000000 329.697000 (329.697295)
...
{noformat}
The critical section which determines the next name to use in initialize does
a linear walk through entire list of not yet cleaned or active list of temp
file pathnames to try and determine a new one. In MRI this list in
temp_benchmark levels out at about 73 and in JRuby it grows without bounds
(JVM is cleaning up objects consistently, but the benchmark is easily able to
outstrip the pace of cleanup).
It seems like rather than try and mangle jruby to work with a poorly though
implementation we should just create our own taking advantage of the Java
platform.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email