Uh oh!
There was an error while loading. Please reload this page.
[3.12] GH-107674: Avoid allocating boxed ints for sys.settrace line events (GH-107780) - #107841
Conversation
…events (pythonGH-107780) (cherry picked from commit 37d8b90) Co-authored-by: Mark Shannon <mark@hotpy.org>
markshannon
commented
Aug 10, 2023
Yhg1s
commented
Aug 11, 2023
How important is this performance improvement? Does it solve all of the reported slowdown, or just some of it? I don't really want pure performance improvements, especially of this complexity, in the bug fix stage, let alone between rc1 and rc2... |
markshannon
commented
Aug 11, 2023
It largely depends on whether coverage.py moves to using PEP 669 for 3.12. It is does, then this is not important at all.
I don't know as yet. I'll get back to you when I have some numbers.
That's understandable. |
ambv
commented
Aug 11, 2023
Closing and re-opening to retrigger CLA checks. Sorry for the noise. |
Yhg1s
commented
Sep 5, 2023
Where are we at with this? Does it make sense to try and get this in now, or are you comfortable making these changes in 3.12.1 if they turn out to be necessary? |
markshannon
commented
Sep 5, 2023
It definitely helps performance of ``sys.settrace`, but performance is not what it was for 3.11. TBH, I think the best way to forward is to help coverage.py move to using So, I'd leave it for now. |
vstinner
commented
Oct 4, 2023
@markshannon@Yhg1s: What's the status of this change? Python 3.12.0 was released without this optimization. I don't think that coverage.py was ported to PEP 669 yet. |
tarpas
commented
Oct 24, 2023
The overhead is killing the utility of https://github.com/tarpas/pytest-testmon. It would be great if it's addressed. |
serhiy-storchaka
commented
Dec 25, 2023
Was this PR forgotten? Should it be merged or closed? |
hugovk
commented
Aug 9, 2024
coverage.py now has support for PEP 669 / Does this still need backporting to 3.12? cc @nedbat |
patrys
commented
Sep 6, 2024
I just found this PR while investigating why Another tool affected is |
nedbat
commented
Sep 6, 2024
Definitely coverage.py still needs sys.settrace to work well for all versions of Python. We are working on sys.monitoring support, but have not found a solution for branch coverage. |
nedbat
commented
Sep 6, 2024
I haven't heard people complaining about the speed on 3.12, but looking at my own coverage runs, I can see a definitely slowdown from 3.11 to 3.12. |
nedbat
commented
Sep 6, 2024
I ran some benchmarks:
(the last three columns would make more sense in reverse order). |
vstinner
commented
Dec 20, 2024
What's the status of this PR created 1 year 1/2 ago? |
Yhg1s
commented
Apr 2, 2025
@markshannon I received some questions about whether this can get applied to 3.12 (because people are still upgrading to 3.12 even though it's nearing the end of its bugfix state). What do you think? |
markshannon
left a comment
There was a problem hiding this comment.
Boxing and unboxing ints is expensive, so avoiding the box/unbox pair is definitely going to help sys.settrace.
This is going to slow down other users of LINE events a tiny bit, but those should be DISABLEing events anyway if they care about performance.
We'll fix this properly for 3.15 with tagged ints, but this fix looks like a worthwhile change in the meantime.
Uh oh!
There was an error while loading. Please reload this page.
(cherry picked from commit 37d8b90)
Co-authored-by: Mark Shannon mark@hotpy.org
Closes#107674