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 serhiy.storchaka
Recipients alexandre.vassalotti, pitrou, rhettinger, serhiy.storchaka
Date 2015-12-29.07:43:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1451375021.62.0.919417769912.issue25856@psf.upfronthosting.co.za>
In-reply-to
Content
Interning the __module__ string causes small performance hit:

$ ./python -m timeit -s "from itertools import chain" -- "chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__; chain.__module__"

Unpatched:  1.93 usec per loop
Patched:    4.09 usec per loop

This can be avoided if cache created string in type's __dict__. Following patch makes __module__ retrieving for non-heap types as fast as for heap types:

Patched2:   0.871 usec per loop
History
Date User Action Args
2015-12-29 07:43:41serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, pitrou, alexandre.vassalotti
2015-12-29 07:43:41serhiy.storchakasetmessageid: <1451375021.62.0.919417769912.issue25856@psf.upfronthosting.co.za>
2015-12-29 07:43:41serhiy.storchakalinkissue25856 messages
2015-12-29 07:43:41serhiy.storchakacreate