[Mono-dev] Patch: Fast virtual generic method calls

Mark Probst mark.probst at gmail.com
Thu Oct 2 06:31:25 EDT 2008


On Wed, Oct 1, 2008 at 8:12 PM, Paolo Molaro <lupus at ximian.com> wrote:
> It would be nice to also see some speedup numbers from this change:)

Running the same benchmark (attached again) that I did on my first,
memory-eating implementation of fast virtual generic method calls I
get these numbers:

no calls: 16.82306
non-generic calls: 21.41356
generic calls: 29.7909

non-generic call cost: 4.5905
generic call cost: 12.96784

Compared to our previous, slow implementation (note that these numbers
are different from the ones I posted back when I wrote about my first
implementation, which I tested on the old JIT, whereas these are with
Linear IL):

no calls: 16.63622
non-generic calls: 21.50949
generic calls: 1067.2657

non-generic call cost: 4.87327
generic call cost: 1050.62948

Compared to Microsoft's:

no calls: 18.90625
non-generic calls: 31.40625
generic calls: 52.96875

non-generic call cost: 12.5
generic call cost: 34.0625

As for performance differences with the threshold change I can only
offer a very contrived benchmark (also attached).  What it does is
call the same virtual generic method with a huge number of different
type arguments.  Calling each different instantiation once, without
the threshold change the program takes 45 seconds, whereas with the
threshold change it only takes 1.2 seconds (because no thunks are
created).  However, by changing the number of calls to each invocation
I can get different performance.  If I call each different
instantiation 10 times (which is the threshold number) then without
the threshold change it still takes only 45 seconds, whereas with the
threshold change it now also takes 45 seconds.  Pretty much what's to
be expected.

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vgmbench.cs
Type: application/octet-stream
Size: 2899 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081002/79f4166a/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vgm2.cs
Type: application/octet-stream
Size: 709 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20081002/79f4166a/attachment-0003.obj 


More information about the Mono-devel-list mailing list