Skip to content

Cache generated methods for performance#99

Merged
DavidCEllis merged 36 commits intomainfrom
cached-source
May 7, 2026
Merged

Cache generated methods for performance#99
DavidCEllis merged 36 commits intomainfrom
cached-source

Conversation

@DavidCEllis
Copy link
Copy Markdown
Owner

This caches methods that are the same 'shape' and reuses them.

This is now used for the comparison methods, __repr__, and __replace__ where the function code is purely defined by the number of arguments and the only difference between functions is the values of constants and names.

There is some extra logic for earlier versions of Python, where co_consts could contain tuples of names and __kwdefaults__ was not settable as an argument to FunctionType

@DavidCEllis DavidCEllis merged commit 0bf2475 into main May 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant