Author serhiy.storchaka
Recipients josh.r, larry, scoder, serhiy.storchaka
Date 2015-02-21.18:37:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1424543841.9.0.038615613558.issue23492@psf.upfronthosting.co.za>
In-reply-to
Content
> Serhiy, I suggest you look at the code that Cython generates for its functions. It has been extensively profiled and optimised (years ago), so generating the same code for the argument clinic should yield the same performance.

Thanks, I'll look on it.

> And while I don't have exact numbers at hand, avoiding the tuple packing for the call by passing it into a METH_O function can make a substantial difference.

Good idea. Here are samples:

$ ./python -m timeit "chr(0x20ac)"
Unpatched: 1000000 loops, best of 3: 0.976 usec per loop
Patched:   1000000 loops, best of 3: 0.752 usec per loop

$ ./python -m timeit -s "from cmath import isnan; x = 1j" -- "isnan(x)"
Unpatched: 1000000 loops, best of 3: 0.62 usec per loop
Patched:   1000000 loops, best of 3: 0.386 usec per loop

Of course for more complex functions the effect is smaller.
History
Date User Action Args
2015-02-21 18:37:21serhiy.storchakasetrecipients: + serhiy.storchaka, scoder, larry, josh.r
2015-02-21 18:37:21serhiy.storchakasetmessageid: <1424543841.9.0.038615613558.issue23492@psf.upfronthosting.co.za>
2015-02-21 18:37:21serhiy.storchakalinkissue23492 messages
2015-02-21 18:37:21serhiy.storchakacreate