New submission from Eric Snow: CPython's C code makes extensive use of global variables. The globals fall into one of several categories:
* (effectively) constants (incl. static types) * freelists, caches, and counters * used exclusively in main or in REPL * process-global state * module state * Python runtime state Those in the last category are not explicitly organized nor easily discoverable. Among other things, this has an impact on efforts that change the runtime (e.g. my multi-core Python project). To improve the situation I'd like to do the following: 1. group the (stateful) runtime globals into various topical structs 2. consolidate the topical structs under a single top-level _PyRuntimeState struct 3. add a check-c-globals.py script that helps identify runtime globals One side effect of consolidating these globals is a significant performance improvement of CPython. Presumably this is due to the caching behavior of a single struct vs. that of dozens of separate globals. I have a patch and will put up a PR momentarily. ---------- assignee: eric.snow messages: 297780 nosy: eric.snow, haypo, ncoghlan, yselivanov priority: normal severity: normal stage: patch review status: open title: Consolidate stateful C globals under a single struct. type: enhancement versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30860> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com