mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Merge pull request #381 from Shopify/add_object_profiling
Add object profiling in addition to cpu profiling
This commit is contained in:
@@ -4,10 +4,14 @@ require File.dirname(__FILE__) + '/theme_runner'
|
|||||||
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
|
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
|
||||||
profiler = ThemeRunner.new
|
profiler = ThemeRunner.new
|
||||||
profiler.run
|
profiler.run
|
||||||
results = StackProf.run(mode: :cpu) do
|
|
||||||
100.times do
|
[:cpu, :object].each do |profile_type|
|
||||||
profiler.run
|
puts "Profiling in #{profile_type.to_s} mode..."
|
||||||
|
results = StackProf.run(mode: profile_type) do
|
||||||
|
100.times do
|
||||||
|
profiler.run
|
||||||
|
end
|
||||||
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
|
end
|
||||||
StackProf::Report.new(results).print_text(false, 20)
|
|
||||||
File.write(ENV['FILENAME'], Marshal.dump(results)) if ENV['FILENAME']
|
|
||||||
|
|||||||
Reference in New Issue
Block a user