[Mono-devel-list] Inefficiencies in mcs

Andreas Nahr ClassDevelopment at A-SoftTech.com
Wed Feb 25 13:38:03 EST 2004


>
> > Hi,
> >
> > ...
> > L_0061:
> >  return num1;
> > }
> >
> > Which intoduces an excess variable of type int and handles all return
> cases
> > at the end instead of immediately doing an constant int - return (which
> > should be faster)
> >
>
> it should, shouldn't it? But does it?
>
> I'm writing a compiler and my earlier tests showed me that code like that
> can
> in fact run faster sometimes... Time it. I'd be curious to know what you
> come up with.

OK - took the time to time it. (using Mono .30 on Windows)

Here are the results:
Direct return: 28621
Indirect : 29061
Second try (Testcode modified to leave on another branch):
Direct return: 28601
Indirect : 29022

The results are probably correct to +/- 20ms

Interrestingly on MS.Net the speed seems equal within the +/- 20ms

So my assumptions seem to be right.
The immediate return seems faster (although the difference obviously isn't
that big)

Andreas




More information about the Mono-devel-list mailing list