Skip to content
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

Move the bodies of large instructions into helper functions. #122598

Closed
markshannon opened this issue Aug 2, 2024 · 1 comment
Closed

Move the bodies of large instructions into helper functions. #122598

markshannon opened this issue Aug 2, 2024 · 1 comment
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@markshannon
Copy link
Member

markshannon commented Aug 2, 2024

There are two reasons for this:

  1. Big chunks of code slow down the JIT and the resulting machine code.
  2. These big chunks of code usually have complex control flow which makes analysis of the code for stack spilling and top-of-stack much harder.

Using tokens are (a quite approximate) guide to complexity, here are the uops with over 200 tokens:

_CALL_BUILTIN_FAST_WITH_KEYWORDS 200
_BINARY_SUBSCR_GETITEM 203
_LOAD_ATTR_GETATTRIBUTE_OVERRIDDEN 210
_CALL_METHOD_DESCRIPTOR_NOARGS 212
_CALL_METHOD_DESCRIPTOR_O 214
_LOAD_FROM_DICT_OR_GLOBALS 215
_YIELD_VALUE 219
_LOAD_SUPER_ATTR 241
_CALL_METHOD_DESCRIPTOR_FAST 247
_CALL_METHOD_DESCRIPTOR_FAST_WITH_KEYWORDS 258
_DYNAMIC_EXIT 269
_STORE_ATTR_WITH_HINT 273
_SEND 274
_EXIT_TRACE 335
_CALL_ALLOC_AND_ENTER_INIT 358
_DO_CALL 365
_CALL_FUNCTION_EX 469
_CALL_KW 498

Linked PRs

@markshannon markshannon added performance Performance or resource usage interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.14 new features, bugs and security fixes labels Aug 2, 2024
@python python deleted a comment from inzk Aug 2, 2024
@markshannon
Copy link
Member Author

Closing as duplicate of #117224

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
Projects
None yet
Development

No branches or pull requests

1 participant