Code Review: LightBinding5

tfpt review “/shelveset:LightBinding5;REDMOND\tomat”

The changeset focuses on reducing time spent in JIT to compile generic
instantiations of various helper methods. These are mostly related to
generic instructions that implement dynamic sites and method calls. It
reduces the number of methods jitted during startup time of irb from 481
to 80 (with -X:CompilationThreshold 10000000), which translates to 34%
time reduction:

rbr -X:CompilationThreshold 10000000 i.rb < exit.txt

i.rb:

s = Time.now
require ‘irb’
IRB.start(FILE)
t = Time.now
p t - s

Before: 0.961096 seconds
After: 0.631063 seconds

DLR

Adds LightDynamicExpression - these reducible nodes reduce to strongly
typed DynamicExpressions yet when interpreted use untyped dynamic sites
(sites typed to CallSite<Func<CallSite, object*>>). Using light sites
avoids jitting generic instantiations of various instructions, stubs and
helpers that are strongly typed to the call-site signature. Also,
strongly typed delegate types are created only when compiling the sites.

Adds helpers to CallInstruction that add MethodInfo to CallInstruction
mapping into the internal cache. These helpers can be used by reflection
caches that look up CLR helper methods. For example, Ruby’s
ReflectionCache holds on MethodInfos for all RubyOps. Whenever a helper
MethodInfo is needed a delegate is created for it and cached into
CallInstruction’s cache along with the instruction that dispatches to
it. Since all static helpers are known upfront the delegates and the
corresponding instructions can all be ngen’d.

Moves helpers for rule interpretation from Ruby to DynamicUtils.

Python
Replaces LazyDynamicExpressions with subclasses of
LightDynamicExpressions.

Ruby
Simplifies rules interpretation, moves related helpers to DLR.
Uses LightDynamicExpression for all dynamic sites.
Uses CallInstruction caching for RubyOps.

Tomas

Tests look good.

JD

From: Dino Viehland
Sent: Wednesday, January 13, 2010 10:46 AM
To: Tomas M.; IronRuby External Code R.; Rowan Code
Reviewers
Cc: [email protected]
Subject: RE: Code Review: LightBinding5

One nitpick: The usings in the namespace in DynamicUtils.cs are
misformatted.

Otherwise looks great!

From: Tomas M.
Sent: Tuesday, January 12, 2010 8:12 PM
To: IronRuby External Code R.; Rowan Code R.
Cc: [email protected]
Subject: Code Review: LightBinding5

tfpt review “/shelveset:LightBinding5;REDMOND\tomat”

The changeset focuses on reducing time spent in JIT to compile generic
instantiations of various helper methods. These are mostly related to
generic instructions that implement dynamic sites and method calls. It
reduces the number of methods jitted during startup time of irb from 481
to 80 (with -X:CompilationThreshold 10000000), which translates to 34%
time reduction:

rbr -X:CompilationThreshold 10000000 i.rb < exit.txt

i.rb:

s = Time.now
require ‘irb’
IRB.start(FILE)
t = Time.now
p t - s

Before: 0.961096 seconds
After: 0.631063 seconds

DLR

Adds LightDynamicExpression - these reducible nodes reduce to strongly
typed DynamicExpressions yet when interpreted use untyped dynamic sites
(sites typed to CallSite<Func<CallSite, object*>>). Using light sites
avoids jitting generic instantiations of various instructions, stubs and
helpers that are strongly typed to the call-site signature. Also,
strongly typed delegate types are created only when compiling the sites.

Adds helpers to CallInstruction that add MethodInfo to CallInstruction
mapping into the internal cache. These helpers can be used by reflection
caches that look up CLR helper methods. For example, Ruby’s
ReflectionCache holds on MethodInfos for all RubyOps. Whenever a helper
MethodInfo is needed a delegate is created for it and cached into
CallInstruction’s cache along with the instruction that dispatches to
it. Since all static helpers are known upfront the delegates and the
corresponding instructions can all be ngen’d.

Moves helpers for rule interpretation from Ruby to DynamicUtils.

Python
Replaces LazyDynamicExpressions with subclasses of
LightDynamicExpressions.

Ruby
Simplifies rules interpretation, moves related helpers to DLR.
Uses LightDynamicExpression for all dynamic sites.
Uses CallInstruction caching for RubyOps.

Tomas

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs