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 eric.snow
Recipients eric.snow, shihai1991, vstinner
Date 2020-01-29.16:23:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580315000.89.0.181426214657.issue39487@roundup.psfhosted.org>
In-reply-to
Content
FTR:

As Martin noted in #19514, there isn't any performance difference for statics, whether local or global.  For static locals the compiler (at least on linux) generates symbols named as "<name>.<#>" and they are treated as global.

One key difference (again, at least on linux; seen using "nm") is that symbols for static globals preserve identifying information, like the originating source file.  For static locals the filename is not preserved and, when there are duplicates, you do not know from which function a particular symbol comes.  So compiled symbols for static globals are *much* easier to identify in the source than symbols for static locals.

Hence static locals complicate something I'm working on: tooling to identify global variables in our source code.  So I'm a fan of efforts to remove duplicates (and move static locals to the explicit global namespace).  Thank you! :)
History
Date User Action Args
2020-01-29 16:23:20eric.snowsetrecipients: + eric.snow, vstinner, shihai1991
2020-01-29 16:23:20eric.snowsetmessageid: <1580315000.89.0.181426214657.issue39487@roundup.psfhosted.org>
2020-01-29 16:23:20eric.snowlinkissue39487 messages
2020-01-29 16:23:20eric.snowcreate