On 17 July 2010 06:00, Caleb Clausen <vikkous / gmail.com> wrote:
> NB: I am Ricardo's mentor for this project.
>
>
> On 7/16/10, Aaron Patterson <aaron / tenderlovemaking.com> 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