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, jcea, pitrou, serhiy.storchaka
Date 2013-04-07.13:25:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1365341141.94.0.603956907363.issue16551@psf.upfronthosting.co.za>
In-reply-to
Content
In response to Alexandre's comment on Rietveld. Access to a local variable is faster than to a global one and the current implementation uses this for struct.pack. I just use same trick for struct.unpack. Here is a microbenchmark which demonstrate some effect of this optimization. I got 0.6491418619989417, 0.6947214259998873, and 0.5394902769985492 for optimized, non-optimized and advanced optimized functions.

Of course, we can achieve even better effect if we will cache not only struct.pack, but struct.Struct('<i').pack, struct.Struct('B').pack, etc. I were considered this as a reason for other patch, but we can do it in this issue.
History
Date User Action Args
2013-04-07 13:25:41serhiy.storchakasetrecipients: + serhiy.storchaka, jcea, pitrou, alexandre.vassalotti
2013-04-07 13:25:41serhiy.storchakasetmessageid: <1365341141.94.0.603956907363.issue16551@psf.upfronthosting.co.za>
2013-04-07 13:25:41serhiy.storchakalinkissue16551 messages
2013-04-07 13:25:41serhiy.storchakacreate