◐ Shell
clean mode source ↗

gh-103092: isolate _lsprof by aisk · Pull Request #115130 · python/cpython

Hi @erlend-aasland, I have a new thought. This change is just to isolate these two static variables:

static unsigned int random_value = 1;
static unsigned int random_stream = 0;

But as they are the state of a pseudo-random generator, they can be shared between interpreters under a lock. For single interpreter usage, there is no noticeable performance decrease. And this work can be done easily.

I have no idea if this approach is acceptable, or whether we should continue with the previous work. If it does, I can do some benchmarking to see if there is a performance decrease in multiple isolated interpreters usage.