Nic30 / hdlConvertor

Fast Verilog/VHDL parser preprocessor and code generator for C++/Python based on ANTLR4
MIT License
277 stars 63 forks source link

release GIL during parsing #71

Open Nic30 opened 4 years ago

Nic30 commented 4 years ago

Currently the Global Interpreter Lock is held even if only C++ code is parsing. Releasing GIL during this time will make multithreading as fast as multiprocessing without need for inter process communication.

Thomasb81 commented 4 years ago

https://github.com/Nic30/hdlConvertor/blob/2d3458d0881483a0be7ff9a2b9628398ff211ee6/hdlConvertor/_hdlConvertor.pyx#L42

To be replace by cdef cppclass Convertor nogil:

Should do the job. (Not tested)

Nic30 commented 4 years ago

It may not be so easy as the python AST object are build in c++, but we may just need to wrap this method in GIL.