[rubygems/rubygems] Use a constant empty tar header to avoid extra allocations
[ruby.git] / benchmark / constant_invalidation.rb
bloba95ec6f37e6aadb9ba20852681a7e1cb682f36fd
1 $VERBOSE = nil
3 CONSTANT1 = 1
4 CONSTANT2 = 1
5 CONSTANT3 = 1
6 CONSTANT4 = 1
7 CONSTANT5 = 1
9 def constants
10   [CONSTANT1, CONSTANT2, CONSTANT3, CONSTANT4, CONSTANT5]
11 end
13 500_000.times do
14   constants
16   # With previous behavior, this would cause all of the constant caches
17   # associated with the constant lookups listed above to invalidate, meaning
18   # they would all have to be fetched again. With current behavior, it only
19   # invalidates when a name matches, so the following constant set shouldn't
20   # impact the constant lookups listed above.
21   INVALIDATE = true
22 end