lib/heap_profiler/parser.rb in heap-profiler-0.3.0 vs lib/heap_profiler/parser.rb in heap-profiler-0.4.0

- old
+ new

@@ -2,10 +2,15 @@ module HeapProfiler module Parser CLASS_DEFAULT_PROC = ->(_hash, key) { "<Class#0x#{key.to_s(16)}>" } + class << self + attr_accessor :batch_size + end + self.batch_size = 10_000_000 # 10MB + class Ruby def build_index(path) require 'json' classes_index = {} classes_index.default_proc = CLASS_DEFAULT_PROC @@ -40,18 +45,16 @@ address.to_i(16) end end class Native - DEFAULT_BATCH_SIZE = 10_000_000 # 10MB - - def build_index(path, batch_size: DEFAULT_BATCH_SIZE) + def build_index(path, batch_size: Parser.batch_size) indexes = _build_index(path, batch_size) indexes.first.default_proc = CLASS_DEFAULT_PROC indexes end - def load_many(path, since: nil, batch_size: DEFAULT_BATCH_SIZE, &block) + def load_many(path, since: nil, batch_size: Parser.batch_size, &block) _load_many(path, since, batch_size, &block) end end class << self