[IronPython] Sin and Sqrt performance (Chris Trimble)

Nathan R. Ernst ernsnat at iit.edu
Tue Apr 18 01:40:30 CEST 2006

I looked at this under the profiler and there is some sillyness in
IronPython that can yield a ~10% perf gain on this micro benchmark (for
example in place add of floating point doubles checks for 3 other types
before seeing if the other type is a double - most likely it's a double and
we should check that first).

Couple of toughts on this:

Wouldn't it be the common case that the types on the lhs and rhs of an
operator are the same?  Also, in the case where the rhs is a literal, don't
you *know* what the type is implicitly (I'm afraid I don't know if this is
being taken into consideration currently)?

It also comes to mind that successive iterations through a loop are likely
to yield the same types for function alls.  Might it be possible to cache
the type information, and recalculation only if a problem is encountered
(such as an int became a long integer, or an iterator that was returning
ints started returning strings)?

On a tangential topic, Dino, what are you using to profile the code?  All
I'm aware of is the CLR profiler, but doesn't this only profile allocations?

-Nathan Ernst

More information about the Ironpython-users mailing list