This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author collinwinter
Recipients collinwinter, jyasskin
Date 2009-02-14.00:13:05
SpamBayes Score 1.8766066e-08
Marked as misclassified No
Message-id <1234570388.11.0.37776511314.issue5176@psf.upfronthosting.co.za>
In-reply-to
Content
Updated the patch to use only PyString_CheckExact(); added a test for
the behaviour of string subclasses wrt the % operator.

There's a very slight performance hit when using % with numbers, but
it's so small as to be statistically insignificant. If it turns out to
be relevant in the future, it's easy enough to add a special case for
ints/longs.

For some reason, using PyString_CheckExact instead of
PyString_CheckExact || PyString_Check actually results in slower code
(still an improvement, but not as much). The weird thing is that none of
the benchmarks I'm running use % on string subclasses at any point. I
talked about it with some of the gcc guys, but they didn't have any
immediate leads. I'm going to send them the .o files in case gcc is
missing some optimization.

New benchmark numbers:
Spitfire:
Min: 0.687 -> 0.668: 2.96% faster
Avg: 0.689 -> 0.669: 2.96% faster

2to3:
Min: 20.376 -> 20.187: 0.94% faster
Avg: 20.396 -> 20.225: 0.84% faster

Django:
Min: 0.560 -> 0.549: 1.94% faster
Avg: 0.562 -> 0.552: 1.93% faster

SlowPickle:
Min: 0.920 -> 0.905: 1.62% faster
Avg: 0.926 -> 0.913: 1.38% faster
History
Date User Action Args
2009-02-14 00:13:08collinwintersetrecipients: + collinwinter, jyasskin
2009-02-14 00:13:08collinwintersetmessageid: <1234570388.11.0.37776511314.issue5176@psf.upfronthosting.co.za>
2009-02-14 00:13:07collinwinterlinkissue5176 messages
2009-02-14 00:13:06collinwintercreate