Skip to content
  • Peter Zhu's avatar
    4cc56592
    Keep write-barrier status after splicing array · 4cc56592
    Peter Zhu authored
    We don't need to remove the write-barrier protected status after
    splicing an array. We can simply add it to the rememberset for marking
    during the next GC.
    
    The benchmark illustrates the performance impact on minor GC:
    
    ```
    require "benchmark"
    
    arys = 1_000_000.times.map do
      ary = Array.new(50)
      ary.insert(1, 3)
      ary
    end
    
    4.times { GC.start }
    
    puts(Benchmark.measure do
      1000.times do
        GC.start(full_mark: false)
      end
    end)
    ```
    
    This branch:
    
    ```
      1.309910   0.004342   1.314252 (  1.314580)
    ```
    
    Master branch:
    
    ```
     54.376091   0.219037  54.595128 ( 54.742996)
    ```
    4cc56592
    Keep write-barrier status after splicing array
    Peter Zhu authored
    We don't need to remove the write-barrier protected status after
    splicing an array. We can simply add it to the rememberset for marking
    during the next GC.
    
    The benchmark illustrates the performance impact on minor GC:
    
    ```
    require "benchmark"
    
    arys = 1_000_000.times.map do
      ary = Array.new(50)
      ary.insert(1, 3)
      ary
    end
    
    4.times { GC.start }
    
    puts(Benchmark.measure do
      1000.times do
        GC.start(full_mark: false)
      end
    end)
    ```
    
    This branch:
    
    ```
      1.309910   0.004342   1.314252 (  1.314580)
    ```
    
    Master branch:
    
    ```
     54.376091   0.219037  54.595128 ( 54.742996)
    ```
Loading