Re: Unusually high polymorphic dispatch costs?

2011-05-05 Thread Christian Thalinger
On Apr 30, 2011, at 9:27 AM, Charles Oliver Nutter wrote: > I have pushed a change to JRuby master that fails over to a simple > inline cache after one failed GWT. This is not how I would want to do > it long-term, but it does bring some benchmarks back in line with > non-indy JRuby. Specifically,

Re: Unusually high polymorphic dispatch costs?

2011-05-02 Thread Mark Roos
range. By the way a code cache flush is pretty fast today, adds about 25 ms to rebuild 500 call sites. Once I add the invalidate I'll see how it fares in java regards mark From: Rémi Forax To: mlvm-dev@openjdk.java.net Date: 05/02/2011 08:59 AM Subject: Re: Unusually high polymo

Re: Unusually high polymorphic dispatch costs?

2011-05-02 Thread Rémi Forax
On 05/01/2011 11:01 PM, Mark Roos wrote: In the Smalltalk I am porting the solution they use is to just drop the entire chain and let it reform. The assumption would be that for any short time period in the life of a program no sites are megamorphic. the metric they use is the total amount of

Re: Unusually high polymorphic dispatch costs?

2011-05-02 Thread Rémi Forax
On 05/01/2011 09:58 PM, Charles Oliver Nutter wrote: > On Sun, May 1, 2011 at 1:01 PM, Mark Roos wrote: >> With respect to chaining gwt handles. >> >> Any thoughts on at what depth the chain should be converted to some other >> form of dispatch? >> I am currently just letting them build >> >> In s

Re: Unusually high polymorphic dispatch costs?

2011-05-01 Thread Mark Roos
In the Smalltalk I am porting the solution they use is to just drop the entire chain and let it reform. The assumption would be that for any short time period in the life of a program no sites are megamorphic. the metric they use is the total amount of active code. Since they actually drop al

Re: Unusually high polymorphic dispatch costs?

2011-05-01 Thread Rémi Forax
On 04/29/2011 09:59 PM, Ola Bini wrote: > Hi, > > Given that creating GWTs are expensive, is it a really bad idea to > create them and bind them on a cache miss then? My current logic for > call sites look something like this: > > invoke call site > if fallback, check if current morphi

Re: Unusually high polymorphic dispatch costs?

2011-05-01 Thread Charles Oliver Nutter
On Sun, May 1, 2011 at 1:01 PM, Mark Roos wrote: > With respect to chaining gwt handles. > > Any thoughts on at what depth the chain should be converted to some other > form of dispatch? > I am currently just letting them build > > In smalltalk it seems that around 10-20 inline tests are about the

Re: Unusually high polymorphic dispatch costs?

2011-05-01 Thread Mark Roos
With respect to chaining gwt handles. Any thoughts on at what depth the chain should be converted to some other form of dispatch? I am currently just letting them build In smalltalk it seems that around 10-20 inline tests are about the same as a hash lookup but I would think it could be diffe

Re: Unusually high polymorphic dispatch costs?

2011-05-01 Thread Rémi Forax
On 04/30/2011 11:13 PM, Charles Oliver Nutter wrote: > Well it seems like the GWT-based PIC could be a *great* success, at > least compared to falling back on a single-entry IC. I will shortly > commit another patch to JRuby master that provides a configurable GWT > chain size before giving up and

Re: Unusually high polymorphic dispatch costs?

2011-04-30 Thread Charles Oliver Nutter
Well it seems like the GWT-based PIC could be a *great* success, at least compared to falling back on a single-entry IC. I will shortly commit another patch to JRuby master that provides a configurable GWT chain size before giving up and going to a simple IC, and the results are spectacular. First

Re: Unusually high polymorphic dispatch costs?

2011-04-30 Thread Charles Oliver Nutter
On Sat, Apr 30, 2011 at 2:27 AM, Charles Oliver Nutter wrote: > I have pushed a change to JRuby master that fails over to a simple > inline cache after one failed GWT. This is not how I would want to do > it long-term, but it does bring some benchmarks back in line with > non-indy JRuby. Specifica

Re: Unusually high polymorphic dispatch costs?

2011-04-30 Thread Charles Oliver Nutter
I have pushed a change to JRuby master that fails over to a simple inline cache after one failed GWT. This is not how I would want to do it long-term, but it does bring some benchmarks back in line with non-indy JRuby. Specifically, bench_richards 100 now runs in a normal amount of time...but i

Re: Unusually high polymorphic dispatch costs?

2011-04-29 Thread Charles Oliver Nutter
I think my strategy is going to be something like this: * Bind first method encountered straight through with a new GWT * Upon encountering nth new method, rebuild GWT chain to check first, second, nth PIC-style * For some N encountered methods, failover to a simple IC Some variation of these (pr

Re: Unusually high polymorphic dispatch costs?

2011-04-29 Thread Ola Bini
Hi, Given that creating GWTs are expensive, is it a really bad idea to create them and bind them on a cache miss then? My current logic for call sites look something like this: invoke call site if fallback, check if current morphism is < 10. If so, create a new GWT with the

Re: Unusually high polymorphic dispatch costs?

2011-04-29 Thread Rémi Forax
On 04/28/2011 09:58 PM, Charles Oliver Nutter wrote: > I'm trying to figure out why polymorphic dispatch is incredibly slow > in JRuby + indy. Take this benchmark, for example: > > class A; def foo; end; end > class B; def foo; end; end > > a = A.new > b = B.new > > 5.times { puts Benchmark.measure

Re: Unusually high polymorphic dispatch costs?

2011-04-29 Thread Christian Thalinger
On Apr 28, 2011, at 9:58 PM, Charles Oliver Nutter wrote: > I'm trying to figure out why polymorphic dispatch is incredibly slow > in JRuby + indy. Take this benchmark, for example: > > class A; def foo; end; end > class B; def foo; end; end > > a = A.new > b = B.new > > 5.times { puts Benchmark

Unusually high polymorphic dispatch costs?

2011-04-28 Thread Charles Oliver Nutter
I'm trying to figure out why polymorphic dispatch is incredibly slow in JRuby + indy. Take this benchmark, for example: class A; def foo; end; end class B; def foo; end; end a = A.new b = B.new 5.times { puts Benchmark.measure { 100.times { a, b = b, a; a.foo; b.foo } } } a.foo and b.foo ar