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 float operations by mutating uniquely-referenced operands in place (JIT only) #146306
When the tier 2 optimizer can prove that an operand to a float binary operation is uniquely referenced, we can mutate it in place instead of allocating a new PyFloatObject. This avoids a PyFloat_FromDouble allocation and the subsequent deallocation of the consumed operand on every iteration.
The unique reference tracking infrastructure added in #144300 can be used for the float operations as well. Also see #90530 where a similar optimization was proposed for tier 1 using runtime refcount checks.
I think the remaining float operations are probably rare and also annoying to account for (e.g. float OP int), so let's consider this done, and expand on it in future issues if need be.
Activity
pythongh-146306: Optimize float arithmetic in JIT by mutating uniquel…
gh-146306: JIT: Optimize float operations by mutating uniquely-refere…
Fidget-Spinner commentedon Mar 24, 2026
I think the remaining float operations are probably rare and also annoying to account for (e.g.
float OP int), so let's consider this done, and expand on it in future issues if need be.The next big thing is probably compact longs.
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: Specialize float/float true division in tier 2 optim…
pythongh-146306: JIT: Optimize float operations by mutating uniquely-…
pythongh-146306: JIT: Optimize float operations by mutating uniquely-…