[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / benchmark / object_allocate.yml
blobbdbd4536db2e6a99f5ccf4f084b231ab45797fb8
1 prelude: |
2   class Eight
3     8.times { include(Module.new) }
4   end
5   class ThirtyTwo
6     32.times { include(Module.new) }
7   end
8   class SixtyFour
9     64.times { include(Module.new) }
10   end
11   class OneTwentyEight
12     128.times { include(Module.new) }
13   end
14   class OnePositional
15     def initialize a; end
16   end
17   class TwoPositional
18     def initialize a, b; end
19   end
20   class ThreePositional
21     def initialize a, b, c; end
22   end
23   class FourPositional
24     def initialize a, b, c, d; end
25   end
26   class KWArg
27     def initialize a:, b:, c:, d:
28     end
29   end
30   class Mixed
31     def initialize a, b, c:, d:
32     end
33   end
34   # Disable GC to see raw throughput:
35   GC.disable
36 benchmark:
37   allocate_8_deep: Eight.new
38   allocate_32_deep: ThirtyTwo.new
39   allocate_64_deep: SixtyFour.new
40   allocate_128_deep: OneTwentyEight.new
41   allocate_1_positional_params: OnePositional.new(1)
42   allocate_2_positional_params: TwoPositional.new(1, 2)
43   allocate_3_positional_params: ThreePositional.new(1, 2, 3)
44   allocate_4_positional_params: FourPositional.new(1, 2, 3, 4)
45   allocate_kwarg_params: "KWArg.new(a: 1, b: 2, c: 3, d: 4)"
46   allocate_mixed_params: "Mixed.new(1, 2, c: 3, d: 4)"
47   allocate_no_params: "Object.new"
48 loop_count: 100000