mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-20 19:30:47 -07:00
Introduce support for memory usage profiles
This commit is contained in:
@@ -2,6 +2,7 @@ source 'https://rubygems.org'
|
|||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
gem 'stackprof', platforms: :mri_21
|
gem 'stackprof', platforms: :mri_21
|
||||||
|
gem 'allocation_tracer', platforms: :mri_21
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'spy', '0.4.1'
|
gem 'spy', '0.4.1'
|
||||||
|
|||||||
@@ -71,6 +71,20 @@ namespace :profile do
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
namespace :memory do
|
||||||
|
|
||||||
|
desc "Run the liquid memory tracer"
|
||||||
|
task :run do
|
||||||
|
ruby "./performance/memory.rb"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "Run the liquid memory tracer with strict parsing"
|
||||||
|
task :strict do
|
||||||
|
ruby "./performance/memory.rb strict"
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
desc "Run example"
|
desc "Run example"
|
||||||
task :example do
|
task :example do
|
||||||
ruby "-w -d -Ilib example/server/server.rb"
|
ruby "-w -d -Ilib example/server/server.rb"
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
require 'allocation_tracer' rescue fail("install allocation_tracer extension/gem")
|
||||||
|
require File.dirname(__FILE__) + '/theme_runner'
|
||||||
|
|
||||||
|
Liquid::Template.error_mode = ARGV.first.to_sym if ARGV.first
|
||||||
|
profiler = ThemeRunner.new
|
||||||
|
|
||||||
|
require 'allocation_tracer/trace'
|
||||||
|
|
||||||
|
puts "Profiling memory usage..."
|
||||||
|
|
||||||
|
200.times do
|
||||||
|
profiler.run
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user