diff options
author | Aaron Patterson <[email protected]> | 2023-10-24 12:43:22 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2023-10-24 14:23:17 -0700 |
commit | d8cb827f39d4c72d2a79e40371ba2a4fb3e95b28 (patch) | |
tree | 9e3caf7e4963712f2aca069e276bc44845a3cebf /test/ruby/test_shapes.rb | |
parent | 33bebee13aedb9f8a0d43cc6921910a690e6f73e (diff) |
Remove SHAPE_MAX_NUM_IVS
There is no longer a limit on the number of IVs you can store.
SHAPE_MAX_NUM_IVS was used to work around the IV10K problem (the well
known problem where setting 10k instance variables in a row would be too
slow). The redblack tree works well at any shape depth, even depths
greater than 80, and solves the IV10K problem.
Diffstat (limited to 'test/ruby/test_shapes.rb')
-rw-r--r-- | test/ruby/test_shapes.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/ruby/test_shapes.rb b/test/ruby/test_shapes.rb index 591fdbe4a3..7849ca546b 100644 --- a/test/ruby/test_shapes.rb +++ b/test/ruby/test_shapes.rb @@ -5,6 +5,8 @@ require 'json' # These test the functionality of object shapes class TestShapes < Test::Unit::TestCase + MANY_IVS = 80 + class IVOrder def expected_ivs %w{ @a @b @c @d @e @f @g @h @i @j @k } @@ -149,7 +151,7 @@ class TestShapes < Test::Unit::TestCase def test_too_many_ivs_on_class obj = Class.new - (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 1).times do + (MANY_IVS + 1).times do obj.instance_variable_set(:"@a#{_1}", 1) end @@ -159,10 +161,10 @@ class TestShapes < Test::Unit::TestCase def test_removing_when_too_many_ivs_on_class obj = Class.new - (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + (MANY_IVS + 2).times do obj.instance_variable_set(:"@a#{_1}", 1) end - (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + (MANY_IVS + 2).times do obj.remove_instance_variable(:"@a#{_1}") end @@ -172,10 +174,10 @@ class TestShapes < Test::Unit::TestCase def test_removing_when_too_many_ivs_on_module obj = Module.new - (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + (MANY_IVS + 2).times do obj.instance_variable_set(:"@a#{_1}", 1) end - (RubyVM::Shape::SHAPE_MAX_NUM_IVS + 2).times do + (MANY_IVS + 2).times do obj.remove_instance_variable(:"@a#{_1}") end |