Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2012 05:34
Show Gist options
  • Save anonymous/1842341 to your computer and use it in GitHub Desktop.
Save anonymous/1842341 to your computer and use it in GitHub Desktop.
require 'ostruct'
class Thing < Struct.new(:x, :y, :z)
end
s = Time.now
100000.times { a = Thing.new(rand, rand, rand) }
p Time.now - s # => 0.1942
s = Time.now
100000.times { a = OpenStruct.new({:x => rand, :y => rand, :z => rand}) }
p Time.now - s # => 6.2625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment