From 32349033a9ab9ce1876272a100621142aee84243 Mon Sep 17 00:00:00 2001 From: Jason Hiltz-Laforge Date: Wed, 16 Jul 2014 15:32:04 +0000 Subject: [PATCH] Add object profiling in addition to cpu profiling --- performance/profile.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/performance/profile.rb b/performance/profile.rb index 69144cb..57b6187 100644 --- a/performance/profile.rb +++ b/performance/profile.rb @@ -4,10 +4,14 @@ require File.dirname(__FILE__) + '/theme_runner' Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first profiler = ThemeRunner.new profiler.run -results = StackProf.run(mode: :cpu) do - 100.times do - profiler.run + +[:cpu, :object].each do |profile_type| + puts "Profiling in #{profile_type.to_s} mode..." + results = StackProf.run(mode: profile_type) do + 100.times do + profiler.run + end end + StackProf::Report.new(results).print_text(false, 20) + File.write(ENV['FILENAME'] + "." + profile_type.to_s, Marshal.dump(results)) if ENV['FILENAME'] end -StackProf::Report.new(results).print_text(false, 20) -File.write(ENV['FILENAME'], Marshal.dump(results)) if ENV['FILENAME']