[Perf] Release the GIL in compute-intensive function#60
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements Global Interpreter Lock (GIL) management in the C++ cache export layer to enable multi-threaded trace processing from Python. Key changes include adding py::gil_scoped_acquire to cache operations that interact with Python objects and utilizing py::call_guard<py::gil_scoped_release> in the Python bindings for long-running simulation tasks. A new test suite, tests/test_gil.py, was added to verify concurrent execution. Review feedback highlights the need to acquire the GIL during cache destruction in pypluginCache_free to avoid crashes when cleaning up Python-owned parameters and suggests optimizing pypluginCache_get by delaying GIL acquisition until after the core C++ lookup is complete to reduce thread contention.
#59
Fixed by release GIL.