Closed I-love-study closed 2 years ago
@I-love-study Can you provide some code to test GIL?
I use the code like this
import asyncio
from time import time
import soundfile
import soxr
data, samplerate = soundfile.read("test.flac")
def resample():
soxr.resample(data, samplerate, 24000)
async def th_resample():
await asyncio.to_thread(resample)
async def main():
t = time()
await asyncio.gather(th_resample())
print(time() - t)
t = time()
await asyncio.gather(th_resample(), th_resample())
print(time() - t)
t = time()
await asyncio.gather(th_resample(), th_resample(), th_resample())
print(time() - t)
t = time()
await asyncio.gather(th_resample(), th_resample(), th_resample(), th_resample())
print(time() - t)
t = time()
await asyncio.gather(th_resample(), th_resample(), th_resample(), th_resample(), th_resample())
print(time() - t)
asyncio.run(main())
@I-love-study Can you confirm and test fix with v0.3.0a2?
pip install soxr==0.3.0a2
Yes, it's working.
c90df4c
Hi, it's nice to see there's a convenient library to use soxr in python. But it seems that it will not release GIL while resampling. Can it release GIL while resampling?