mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-19 02:40:41 -07:00
debug: track expression parse time
This commit is contained in:
@@ -176,7 +176,12 @@ module Liquid
|
|||||||
# Example:
|
# Example:
|
||||||
# products == empty #=> products.empty?
|
# products == empty #=> products.empty?
|
||||||
def [](expression)
|
def [](expression)
|
||||||
evaluate(Expression.parse(expression))
|
start = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond)
|
||||||
|
expression_parse_result = Expression.parse(expression)
|
||||||
|
duration = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond) - start
|
||||||
|
registers.static[:expression_parse_duration] ||= 0
|
||||||
|
registers.static[:expression_parse_duration] += duration
|
||||||
|
evaluate(expression_parse_result)
|
||||||
end
|
end
|
||||||
|
|
||||||
def key?(key)
|
def key?(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user