You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add documentation for release_gil parameter in README
Added a new "Multi-threading and GIL Control" section explaining:
- The release_gil parameter and its three modes (None/auto, True, False)
- When to use each mode for optimal performance
- Examples for resample(), Resampler.process(), and CallbackResampler.read()
Co-authored-by: shauneccles <21007065+shauneccles@users.noreply.github.com>
See `samplerate.resample`, `samplerate.Resampler`, and `samplerate.CallbackResampler` in the API documentation for details.
60
60
61
+
## Multi-threading and GIL Control
62
+
63
+
All resampling methods support a `release_gil` parameter that controls Python's Global Interpreter Lock (GIL) during resampling operations. This is useful for optimizing performance in different scenarios:
64
+
65
+
```python
66
+
import samplerate
67
+
68
+
# Default: "auto" mode - releases GIL only for large data (>= 1000 frames)
69
+
# Balances single-threaded performance with multi-threading capability
70
+
output = samplerate.resample(input_data, ratio)
71
+
72
+
# Force GIL release - best for multi-threaded applications
73
+
# Allows other Python threads to run during resampling
-[scikits.samplerate](https://pypi.python.org/pypi/scikits.samplerate) implements only the Simple API and uses [Cython](http://cython.org/) for extern calls. The resample function of scikits.samplerate and this package share the same function signature for compatiblity.
0 commit comments