mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 02:40:41 -07:00
Merge pull request #492 from Shopify/resource-counting-perf
Resource counting perf
This commit is contained in:
@@ -18,7 +18,9 @@ module Liquid
|
||||
:locale => I18n.new
|
||||
}
|
||||
|
||||
attr_accessor :root, :resource_limits
|
||||
attr_accessor :root
|
||||
attr_reader :resource_limits
|
||||
|
||||
@@file_system = BlankFileSystem.new
|
||||
|
||||
class TagRegistry
|
||||
@@ -110,7 +112,7 @@ module Liquid
|
||||
end
|
||||
|
||||
def initialize
|
||||
@resource_limits = self.class.default_resource_limits.dup
|
||||
@resource_limits = ResourceLimits.new(self.class.default_resource_limits)
|
||||
end
|
||||
|
||||
# Parse source code.
|
||||
@@ -203,6 +205,9 @@ module Liquid
|
||||
context.add_filters(args.pop)
|
||||
end
|
||||
|
||||
# Retrying a render resets resource usage
|
||||
context.resource_limits.reset
|
||||
|
||||
begin
|
||||
# render the nodelist.
|
||||
# for performance reasons we get an array back here. join will make a string out of it.
|
||||
|
||||
Reference in New Issue
Block a user