N = ARGV[0].to_i
T = ARGV[1] || 'eval'
class Foo
if T == 'eval'
N.times do |i|
class_eval "def hello_#{i}; end"
end
else
N.times do |i|
define_method("hello_#{i}") { }
end
end
end
GC.start
sleep
Created
February 12, 2013 03:37
class_eval vs define_method memory usage
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment