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 vstinner
Recipients JelleZijlstra, eric.smith, methane, ncoghlan, pitrou, rhettinger, serhiy.storchaka, vstinner, xiang.zhang
Date 2017-07-17.12:33:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1500294831.25.0.819011806412.issue28638@psf.upfronthosting.co.za>
In-reply-to
Content
Sorry, I don't have much data at this point, but it's not the first time that I noticed that namedtuple is super slow. We have much more efficient code like structseq in C. Why not reusing it at least in our stdlib modules?

About the _source attribute, honestly, I'm not aware of anyone using it. I don't think that the fact that a *private* attribute is document should prevent it to make Python faster.

I already noticed the _source attribute when I studied the Python memory usage. See my old isuse #19640: "Drop _source attribute of namedtuple (waste memory)", I later changed the title to "Dynamically generate the _source attribute of namedtuple to save memory)".

About "Python startup time doesn't matter", this is just plain wrong. Multiple core developers spent a lot of time on optimizing exactly that. Tell me if you really need a long rationale to work on that.

While I'm not sure about Naoki's exact optimization, I agree about the issue title: "Optimize namedtuple creation", and I like the idea of keeping the issue open to find a solution.
History
Date User Action Args
2017-07-17 12:33:51vstinnersetrecipients: + vstinner, rhettinger, ncoghlan, pitrou, eric.smith, methane, serhiy.storchaka, xiang.zhang, JelleZijlstra
2017-07-17 12:33:51vstinnersetmessageid: <1500294831.25.0.819011806412.issue28638@psf.upfronthosting.co.za>
2017-07-17 12:33:51vstinnerlinkissue28638 messages
2017-07-17 12:33:51vstinnercreate