Local scopes are always using ManyVars scope solely for flip-flop behavior
--------------------------------------------------------------------------
Key: JRUBY-2775
URL: http://jira.codehaus.org/browse/JRUBY-2775
Project: JRuby
Issue Type: Bug
Components: Performance
Reporter: Charles Oliver Nutter
Assignee: Charles Oliver Nutter
Fix For: JRuby 1.1.3
The fix for JRUBY-2046, which resolved several issues with flip-flop,
ultimately caused all local scopes to use ManyVarsDynamicScope, the array-based
growable version. While this fixed flip-flops (which appear to be causing a new
variable to come into existence at runtime), it also had the effect of making
all local scopes be ManyVars based. ManyVars is more expensive than the
specific-sized scopes, so ultimately this was a performance hit for methods of
zero or one variable:
{noformat}
With fix (trunk):
➔ jruby -X-C --server test/bench/bench_fib_recursive.rb 10
1.186000 0.000000 1.186000 ( 1.186000)
0.893000 0.000000 0.893000 ( 0.892000)
0.892000 0.000000 0.892000 ( 0.891000)
0.875000 0.000000 0.875000 ( 0.876000)
0.885000 0.000000 0.885000 ( 0.884000)
0.865000 0.000000 0.865000 ( 0.866000)
0.861000 0.000000 0.861000 ( 0.861000)
0.864000 0.000000 0.864000 ( 0.864000)
0.867000 0.000000 0.867000 ( 0.867000)
0.896000 0.000000 0.896000 ( 0.896000)
Without fix:
➔ jruby -X-C --server test/bench/bench_fib_recursive.rb 10
1.033000 0.000000 1.033000 ( 1.033000)
0.775000 0.000000 0.775000 ( 0.775000)
0.831000 0.000000 0.831000 ( 0.831000)
0.749000 0.000000 0.749000 ( 0.749000)
0.757000 0.000000 0.757000 ( 0.756000)
0.763000 0.000000 0.763000 ( 0.763000)
0.755000 0.000000 0.755000 ( 0.754000)
0.762000 0.000000 0.762000 ( 0.762000)
0.762000 0.000000 0.762000 ( 0.762000)
0.762000 0.000000 0.762000 ( 0.761000)
{noformat}
It appears the issue may be that flip-flop variables always bubble to the
containing local scope. I would suggest that perhaps that's an impl-specific
detail, and that we should make the flip-flop variable specific to the scope in
which it is contained. But ultimately, we could get a very nice perf/memory
boost by finding a way to get back to specific-sized scopes.
--
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