-
-
Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-143421: Lazily allocate tracer code and opt buffers #143597
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
Conversation
|
Should we remove the newly added |
Let's keep it. It's a good refactor. |
| // Holds locals, stack, locals, stack ... co_consts (in that order) | ||
| #define MAX_ABSTRACT_INTERP_SIZE 4096 | ||
| // Holds locals, stack, locals, stack ... (in that order) | ||
| #define MAX_ABSTRACT_INTERP_SIZE 512 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This number was picked arbitrarily by me back then when I first wrote this. I now realise it's overkill. We don't need 3 pages of memory just to store locals and stack. It's slow and wastes memory.
|
This makes no sense to me. How is allocating the necessary memory piecemeal faster than allocating it in a single chunk? |
|
@markshannon no the problem was embedding it as a part of |
|
The benchmark doesn't run any work to use the JIT, instead it just measures thread startup overhead https://github.com/python/pyperformance/blob/main/pyperformance/data-files/benchmarks/bm_concurrent_imap/run_benchmark.py#L19 Embedding the two structs together in the |
|
It shouldn't be embedded, it should be heap allocated as one |
Ok let me just put a up a PR to do that. |
I verified on my system this restores the old performance.