Lazy locals dict for NEWLOCALS frames by youknowone · Pull Request #7307 · RustPython/RustPython
marked this pull request as ready for review
Defer locals dict allocation for function frames until first access. Most function frames only use fastlocals and never touch the locals dict, so this skips one dict heap allocation per function call. Also remove a redundant code.clone() in invoke_with_locals. Func call ~23% faster, method call ~15% faster in benchmarks.
youknowone added a commit to youknowone/RustPython that referenced this pull request
Defer locals dict allocation for function frames until first access. Most function frames only use fastlocals and never touch the locals dict, so this skips one dict heap allocation per function call. Also remove a redundant code.clone() in invoke_with_locals. Func call ~23% faster, method call ~15% faster in benchmarks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters