Performance Impact of Generating 100's of Dynamic Methods in Ruby?

Posted by viatropos on Stack Overflow See other posts from Stack Overflow or by viatropos
Published on 2010-05-17T05:56:05Z Indexed on 2010/05/17 6:00 UTC
Read the original article Hit count: 195

Filed under:
|
|

What are the performance issues associated with generating 100's of dynamic methods in Ruby?

I've been interested in using the Ruby Preferences Gem and noticed that it generates a bunch of helper methods for each preference you set.

For instance:

class User < ActiveRecord::Base
  preference :hot_salsa
end

...generates something like:

user.prefers_hot_salsa?         # => false
user.prefers_hot_salsa          # => false

If there are 100's of preferences like this, how does this impact the application? I assume it's not really a big deal but I'm just wondering, theoretically.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about Performance