Skip to content

Conversation

@markshannon
Copy link
Member

@markshannon markshannon 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

@markshannon markshannon 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-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Apr 8, 2021
@markshannon markshannon requested a review from gvanrossum April 9, 2021 16:52
@markshannon markshannon force-pushed the faster-tracing-test branch from df375c4 to 577cafd Compare April 12, 2021 11:25
@markshannon markshannon merged commit 9e7b207 into python:master Apr 13, 2021
@bedevere-bot
Copy link

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

Sign up for free to 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