You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Optimize len for string constants in optimizer #144140
Hi team, I found an optimization opportunity: len() calls on string constants can be
optimized at compile time, similar to how tuple constants are handled.
Quick testing with python -m test showed _CALL_LEN hits:
str: 23 (6 optimizable with this patch)
list: 28
tuple: 4 (3 already optimized)
This patch extends the existing constant folding for len(tuple) to also handle
len("string"), replacing the function call with _SHUFFLE_3_LOAD_CONST_INLINE_BORROW
when the result is an immortal integer.
Activity
pythongh-144140: Optimize len for string constants in optimizer
gh-144140: Optimize len for string constants in optimizer (GH-144142)
pythongh-144140: Optimize len for string constants in optimizer (pyth…
gh-144140: Optimize len for frozen dict/set constants in optimizer (#…