> I don't want to discourage you, but this is unlikely to produce
> significant speedups on real-world code. The simple reason is that
> comparing to None is not a bottleneck for any real application --
> comparing to None is probably damn fast compared to everything else
> the real application do
Thanks for the pointers -- I wasn't aware of perf timeit. I'll try to
get some more stable benchmark results. -Ben
On Wed, Jun 28, 2017 at 10:20 AM, Victor Stinner
wrote:
> (Victor wears his benchmark hat.)
>
> 2017-06-28 15:50 GMT+02:00 Ben Hoyt :
>> ../test_none.sh
>> x = 1234; x is None -- 200
On Wed, 28 Jun 2017 09:50:10 -0400
Ben Hoyt wrote:
> I've now got a patch to add new COMPARE_IS_NONE and
> COMPARE_IS_NOT_NONE bytecodes to CPython to attempt to speed up the
> very common "is None" and "is not None" expressions. It's a very
> simple change overall. Here is my patch:
> https://gis
(Victor wears his benchmark hat.)
2017-06-28 15:50 GMT+02:00 Ben Hoyt :
> ../test_none.sh
> x = 1234; x is None -- 2000 loops, best of 5: 19.8 nsec per loop
> x = 1234; x is not None -- 1000 loops, best of 5: 20 nsec per loop
> x = None; x is None -- 1000 loops, best of 5: 20.7 nsec pe
I've now got a patch to add new COMPARE_IS_NONE and
COMPARE_IS_NOT_NONE bytecodes to CPython to attempt to speed up the
very common "is None" and "is not None" expressions. It's a very
simple change overall. Here is my patch:
https://gist.github.com/benhoyt/e5ba19afe7b869fd743c1c39fc2afdf8
Note: T