[rspec-users] Performance Questions (Was: class << self considered harmful... really?)

aslak hellesoy aslak.hellesoy at gmail.com
Fri Nov 28 16:57:12 EST 2008


On Fri, Nov 28, 2008 at 10:28 PM, Scott Taylor <
mailing_lists at railsnewbie.com> wrote:

>
> On Nov 28, 2008, at 11:52 AM, David Chelimsky wrote:
>
>  On Thu, Nov 27, 2008 at 8:17 PM, Mark Wilden <mark at mwilden.com> wrote:
>>
>>> On Thu, Nov 27, 2008 at 5:57 PM, Brian Takita <brian.takita at gmail.com>
>>> wrote:
>>>
>>>>
>>>> I'm wondering if this is a discussion about taste.
>>>>
>>>
>>> I think you're right. I've been using the 'def self.foo' style in various
>>> languages for almost 20 years, so of course it feels more natural to me.
>>> These languages (except for Smalltalk) had nowhere near the
>>> metaprogramming
>>> capability nor 'objects all the way down'-ness of Ruby, and 'class <<
>>> self'
>>> is one of those things.
>>>
>>> ///ark
>>>
>>
>> FWIW, the blog that led to this discussion suggested a performance
>> impact as well. As RSpec has gotten dinged for being slower than
>> alternatives, that interested me, so I did a little experiment def'ing
>> methods 10k times with def self.method and class << self; def method
>> ....
>>
>>
> I'd be curious to see those benchmarks.
>
> Also - re: performance: I've always wondered why RSpec (and other ruby
> projects, for that matter) aren't using Kernel#autoload instead of
> Kernel#require.   If we used autoload, we wouldn't have to load the code
> for, say, a matcher which is never used in a project.
>

I didn't even know about that method. I don't think I've ever seen it used.
I'll definitely try it out.

Cheers,
Aslak


>
> Scott
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081128/6ae0439a/attachment-0001.html>


More information about the rspec-users mailing list