Project

General

Profile

Feature #15899 » test_mem.rb

edd314159 (Edd Morgan), 07/09/2019 06:33 PM

 
require "memory_profiler"

STRING = "the quick brown fox jumps over the lazy dog"
SEP = "fox"

before_report = MemoryProfiler.report do
head = STRING.before(SEP)
end

before_report.pretty_print

partition_report = MemoryProfiler.report do
head, _seperator, _tail = STRING.partition(SEP)
end

partition_report.pretty_print
(2-2/3)