Sha256: f033c45f6f5f10bc42d8c60249488dd7c4e185b311041e60fbe88ea69c4a3d12

Contents?: true

Size: 561 Bytes

Versions: 2

Compression:

Stored size: 561 Bytes

Contents

# frozen_string_literal: true

require_relative '../lib/finite_machine'

5.times do
  puts

  GC.start

  gc_before = GC.stat
  objects_before = ObjectSpace.count_objects
  p objects_before[:T_OBJECT]

  1_000.times do
    FiniteMachine.new do
      initial :green

      events { event :slow, :green => :yellow }
    end
  end

  objects_after = ObjectSpace.count_objects
  gc_after = GC.stat
  p objects_after[:T_OBJECT]

  p "GC count: #{gc_after[:count] - gc_before[:count]}"
  p "Objects count: #{objects_after[:T_OBJECT] - objects_before[:T_OBJECT]}"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
finite_machine-0.12.1 benchmarks/memory_usage.rb
finite_machine-0.12.0 benchmarks/memory_usage.rb