On Mon, Apr 1, 2013 at 8:26 AM, Edoardo Rossi <edd.rossi / gmail.com> wrote:

> On Mon, Apr 1, 2013 at 12:07 AM, Adam Prescott <adam / aprescott.com> wrote:
> > Your benchmark looks okay. I added a comment to your Gist about a fork
> > I made that shows the O(n) behaviour of include? versus the
> > constant-time behaviour of respond_to? by just tweaking your code.
>

Yeah, Array lookup is O(n) - that's what one would expect.  But the Array
creation has overhead as well.

Thank you so much Adam.
> Very interesting... appreciated.


I think the situation is more dramatic: for a single method test the
#instance_methods call needs to be included.

https://gist.github.com/rklemme/5299235

Kind regards

robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/