But I’m not so confident with the result… if someone have 3min to
lose reading my script, can tell me if I’m completly missing the point
in such kind of test?
Maybe there is some improvements that needs to be done.
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.
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.
Thank you so much Adam.
Very interesting… appreciated.
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.