Sure. The plan is to use __thread when possible ;-)
Victor
On Thu, Feb 25, 2021 at 4:58 AM 谢俊逸 via Python-Dev
wrote:
>
> On MacOS & iOS, __thread variable is 35% faster than using
> pthread_getspecific.
>
> getSpecific cost: 0.000649
> getTLS cost: 0.000423
>
>
> - (void)test { double t1 = CFAb
On MacOS & iOS, __thread variable is 35% faster than using pthread_getspecific.
getSpecific cost: 0.000649
getTLS cost: 0.000423
- (void)test {
double t1 = CFAbsoluteTimeGetCurrent();
for (int i = 0; i < 10; i++) {
[self getSpecific];
}
double t2 = CFAbsoluteTimeGetC
On 2020-03-24 16:31, Mark Shannon wrote:
Hi,
As an experiment, I thought I would try moving the thread state (what
you get from _PyThreadState_GET() ) to TLS.
https://github.com/python/cpython/compare/master...markshannon:threadstate_in_tls
It works, passing all the tests, and seems sound
Hi Mark,
Le mar. 24 mars 2020 à 21:05, Mark Shannon a écrit :
> A native thread can only have one Python thread at a time, and must
> switch using the PyThreadState_Swap() API.
Right.
> So, I think the answer is yes.
Nice.
> Do you have a specific example or testcase?
I don't know well the C
On 24/03/2020 5:26 pm, Victor Stinner wrote:
Does it work with subinterepreters? Especially when a native thread
has two Python thread states of two different interpreters.
A native thread can only have one Python thread at a time, and must
switch using the PyThreadState_Swap() API.
So, I t
Does it work with subinterepreters? Especially when a native thread
has two Python thread states of two different interpreters.
Victor
Le mar. 24 mars 2020 à 16:36, Mark Shannon a écrit :
>
> Hi,
>
> As an experiment, I thought I would try moving the thread state (what
> you get from _PyThreadSt