From: Benoit Daloze Date: 2010-07-18T00:12:25+09:00 Subject: [ruby-core:31331] Re: [rubysoc] Queue C-extension patch to come On 17 July 2010 06:00, Caleb Clausen wrote: > NB: I am Ricardo's mentor for this project. > > > On 7/16/10, Aaron Patterson wrote: >> It looks like this patch is just a port of the ruby code to C, but not >> using a native queue system. > > What native queue system? As far as I know, there aren't any kind of > queue apis available from the OS on either posix or win32 systems. > >> Can you show us benchmarks between this >> version and the pure ruby implementation? > > That's not really needed. It should be obvious that c code is faster > than ruby code. > It is not (for me at least), if you call the "top" Ruby api (which is directly (or almost) bound to Ruby methods (eg: rb_ary_new()), the gain is insignificant. (I imagine you only bypass parsing the Ruby code) Maybe this will improve a little the speed because it uses a C-struct instead of ruby instance variables, and no block is used (instead you just lock/unlock the mutex). Sorry to not be so optimistic as you, but this gain is not obvious to me. Also, I used to love some basic classes written in Ruby themselves (like Queue), (when the performance lost is not too important). I remember when I learned about Queue, just looking the source taught me immediately what it was about. I believe looking at your code is far less easy to read and understand (compared to Ruby I mean). I hope you will show us a significant performance gain, Benoit Daloze