-
Notifications
You must be signed in to change notification settings - Fork 49
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use member non-pointer declarations in Py*State structs instead of heap-allocated pointers. #79
Comments
As a passing comment: a large majority of MicroPython's data structures are statically defined, and even const so they can be put directly in the text section (and usually that is physical ROM). This helps immensely with both fast start up time and minimal RAM usage. |
This comment has been minimized.
This comment has been minimized.
Related: python/cpython#29274 |
@markshannon, I'd like your thoughts on the approach I'm considering for this. It also ties into the discussions we've had on how to deal with all our static variables. You can see the change for my branch here: python/cpython@main...ericsnowcurrently:per-interpreter-globals There are several things that I've tried out:
For most of those, each maps to a single commit, so it may be useful to look at the commits separately. |
FYI, I've been working on eliminating So there may be extra speedup from this that I wasn't expecting. 🙂 |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
The full runtime state of a cpython process is found in
PyRuntimeState
,PyInterpreterState, and
PyThreadState(and, for now, a bunch of static variables), which currently form a single tree at runtime under the
_PyRuntime` global variable. Currently these three structs hold many pointers, which are (allocated and) populated during runtime initialization.For most of the pointers we could instead replace them with static declarations (of the the corresponding data) in the relevant
Py*State
structs. (This wouldn't work for any variables where the size isn't fixed at compile time (e.g.PyVarObject
) but it should work for most.)Benefits
The text was updated successfully, but these errors were encountered: