[pypy-issue] Issue #2513: nogil-unsafe-2 has gil ? (pypy/pypy)

Altan Özlü issues-reply at bitbucket.org
Thu Mar 23 11:56:30 EDT 2017


New issue 2513: nogil-unsafe-2 has gil ?
https://bitbucket.org/pypy/pypy/issues/2513/nogil-unsafe-2-has-gil

Altan Özlü:

Hi! i want to work around gil-less pypy and i did compile nogil-unsafe-2 branch 

```
#!python

import threading,time

def x():
    b=0
    for a in range(20000000):b+=a*a
class myThread (threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
    def run(self):
        x()
t=time.time()
trs=[]
for c in range(4):
    m=myThread()
    m.start()
    trs.append(m)
for tr in trs:tr.join()
print "4 thread",time.time()-t
t=time.time()
for c in range(4):
    x()
print "1 thread", time.time()-t
```

* 4 thread 1.40300607681
* 1 thread 1.34966206551

why it doesn't work ?




More information about the pypy-issue mailing list