Commit 41a956a
committed
fast-path hash() for exact PyStr
str.__hash__ can’t be overridden, so for exact PyStr instances we
skip the attribute lookup and MRO walk and call the string hash directly.
This reduces overhead on hot paths (e.g. dict/set key hashing) while keeping
subclass semantics intact (downcast_ref_if_exact).1 parent a9a9e3b commit 41a956a
1 file changed
+5
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
642 | 642 | | |
643 | 643 | | |
644 | 644 | | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
645 | 650 | | |
646 | 651 | | |
647 | 652 | | |
| |||
0 commit comments