File: measure_allocations.rb

package info (click to toggle)
ruby-prof 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,092 kB
  • sloc: ruby: 10,664; ansic: 2,946; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 396 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Some classes used in measurement tests
class Allocator
  def make_arrays
    10.times {|i| Array.new}
  end

  def make_hashes
    Hash.new
    Hash.new
    Hash.new
    Hash.new
    Hash.new
  end

  def make_strings
    a_string = 'a'
    b_string = a_string * 100
    String.new(b_string)
  end

  def run
    make_arrays
    make_hashes
    make_strings
  end
end