Sha256: ccec72be2a35423742853a9f65721d5911434f8a87ddae02fccc802683f9bc81
Contents?: true
Size: 846 Bytes
Versions: 9
Compression:
Stored size: 846 Bytes
Contents
require 'lib/arrayfields' STDOUT.sync = true n = Integer((ARGV.shift or (2 ** 16))) # # hash mem usage - around 13016 on my machine # fork do a = [] n.times do a << {'a' => 0, 'b' => 1, 'c' => 2} end puts "pid <#{ Process.pid }>" system "ps wwwaux | grep #{ Process.pid }" print "run top to examine mem usage of <#{ n }> hashes (enter when done) >" STDIN.gets end Process.wait # # arrayfields mem usage - around 8752 on my machine # fork do fields = %w( a b c ) a = [] n.times do t = [0,1,2] t.fields = fields t.extend ArrayFields a << [0,1,2] end puts "pid <#{ Process.pid }>" system "ps wwwaux | grep #{ Process.pid }" print "run top to examine mem usage of <#{ n }> extended arrays (enter when done) >" STDIN.gets end Process.wait
Version data entries
9 entries across 9 versions & 2 rubygems