Major performance problem wrapping/unwrapping blocks/procs
----------------------------------------------------------
Key: JRUBY-2756
URL: http://jira.codehaus.org/browse/JRUBY-2756
Project: JRuby
Issue Type: Bug
Components: Performance
Reporter: Charles Oliver Nutter
Assignee: Charles Oliver Nutter
Priority: Blocker
Fix For: JRuby 1.1.3
JRUBY-2752 uncovered a terrible performance problem in block
wrapping/unwrapping (&b). For the attached script there, we are something like
20-30x slower than MRI. The problem appears to be the fact that it wraps and
unwraps a proc/block for every call to its worker methods. A modification of
the script to use blocks that just yield {|x| yield x} eliminates the
performance problem, and shows us being faster than MRI. So it's basically just
the wrapping/unwrapping or the fact that it's a proc causing the performance
hit.
Here's the results before modifying the script:
{noformat}
~/NetBeansProjects/jruby ➔ time jruby --server tester2.rb
Found 712890 numbers under 10000000.
Max jump: 104691 (1098765 -- 1203456).
real 0m49.438s
user 0m48.339s
sys 0m0.766s
~/NetBeansProjects/jruby ➔ time ruby tester2.rb
Found 712890 numbers under 10000000.
Max jump: 104691 (1098765 -- 1203456).
real 0m4.570s
user 0m4.465s
sys 0m0.045s
{noformat}
And here's the results after modifying:
{noformat}
~/NetBeansProjects/jruby ➔ time jruby --server tester2.rb
Found 712890 numbers under 10000000.
Max jump: 104691 (1098765 -- 1203456).
real 0m3.780s
user 0m4.128s
sys 0m0.177s
~/NetBeansProjects/jruby ➔ time ruby tester2.rb
Found 712890 numbers under 10000000.
Max jump: 104691 (1098765 -- 1203456).
real 0m6.283s
user 0m6.207s
sys 0m0.042s
{noformat}
This is a blocker for 1.1.3, since so much code out there wraps and unwraps
blocks.
--
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