[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: Speed of uniq
From:       Phrogz <phrogz () mac ! com>
Date:       2010-02-28 14:30:06
Message-ID: 30284737-c8d5-4ab0-90ed-62722dab5756 () q15g2000yqj ! googlegroups ! com
[Download RAW message or body]

On Feb 28, 7:10 am, Ralph Shnelvar <ral...@dos32.com> wrote:
> (1) How can I tell if a method like uniq is "native" to Ruby.  That is, it's not \
> been added as a C extension and/or is not a Ruby method.

Look in the source code.
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/

In this case, look for "rb_ary_uniq".
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?view=markup

(You can search for a phrase from the ri documentation to find the
method.)

> (2) A C++ program is producing YAML from a ragged array.  As I go through each row \
> of the ragged array in the C++ program, I could detect if all items are unique ... \
> or I can do this in Ruby.  I'd prefer to do this in Ruby if the cost is not "too \
> high".

If this is a question, I don't understand it.


> (3) Is there an easy way to find out how uniq is implemented in 1.8 and 1.9?

Look in the source code.
You can find the different branches of Ruby here:
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic