Skip to content

Conversation

@markshannon
Copy link
Member

@markshannonmarkshannon commented Apr 8, 2021

The code to check if tracing is active occurs once per opcode in the interpreter and is executed in the order of 100 million times per second. It needs to be as efficient as possible. It cannot be kept in a register as it needs to be modified outside of the interpreter, so on the C stack is the fastest possible location for it.

This PR keeps use_tracing in the C frame of the current interpreter making the check for tracing as fast as possible.

Doing so complicates access to use_tracing from other code and requires us to be careful about maintaining stack discipline.
For anything less performance critical than use_tracing this probably wouldn't be worth it, but as use_tracing is so performance critical it is worth it.

https://bugs.python.org/issue43760

@markshannonmarkshannon added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @markshannon for commit 5ba8650 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-botbedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2021
@markshannonmarkshannon merged commit 9e7b207 into python:masterApr 13, 2021
@bedevere-bot
Copy link

@markshannon: Please replace # with GH- in the commit message next time. Thanks!

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@markshannon@bedevere-bot@gvanrossum@the-knights-who-say-ni