chuckremes / ffi-rzmq

FFI bindings for ZeroMQ so the library can be used under JRuby and other FFI-compliant ruby runtimes
242 stars 62 forks source link

Improve FFI syntax and readability #100

Closed stakach closed 10 years ago

stakach commented 10 years ago

Might as well release the GIL on libc too.

minrk commented 10 years ago

I'm not as familiar with the Ruby runtime, but in Python there is a finite cost to releasing and reacquiring the GIL. Originally, pyzmq released the GIL on every libzmq API call, but now it only does this on actual blocking methods (send, recv, close, term, etc.), because it turns out that it performs better when you don't release the GIL unnecessarily.

stakach commented 10 years ago

Might be worth benchmarking. My primary use is with Rubinius and the changes here can't be too detrimental as most functions were marked as blocking already. This was really just for readability

minrk commented 10 years ago

Makes sense - I'm fine with this change as-is, I just thought I would bring up my experience from pyzmq since it seemed relevant to the code being touched. Benchmarking can be another project.

Since this is really a style change, I will defer to @chuckremes for merge.

chuckremes commented 10 years ago

I think the style change is fine. That syntax didn't exist when I first wrote the code so I'm happy to move to a more compact use. Thanks for the work!