Sha256: 4781b6956357d606055217c4acf5edcd37ee6830bab9908cdf2fe745788285a7

Contents?: true

Size: 752 Bytes

Versions: 8

Compression:

Stored size: 752 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 }>"
    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 }>"
    print "run top to examine mem usage of <#{ n }> extended arrays (enter when done) >"
    STDIN.gets
  end
  Process.wait

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
arrayfields-3.6.0 test/memtest.rb
arrayfields-4.1.0 test/memtest.rb
arrayfields-4.2.0 test/memtest.rb
arrayfields-3.7.0 test/memtest.rb
arrayfields-4.0.0 test/memtest.rb
arrayfields-4.3.0 test/memtest.rb
arrayfields-4.4.0 test/memtest.rb
arrayfields-4.5.0 test/memtest.rb