mirror of
https://github.com/kemko/liquid.git
synced 2026-01-05 01:35:41 +03:00
defer hash allocation in parse_filter_expressions
add exploration of GC object allocation remove performance test can actually remove one more if branch use named locals to improve readability
This commit is contained in:
@@ -95,16 +95,17 @@ module Liquid
|
||||
|
||||
def parse_filter_expressions(filter_name, unparsed_args)
|
||||
filter_args = []
|
||||
keyword_args = {}
|
||||
keyword_args = nil
|
||||
unparsed_args.each do |a|
|
||||
if matches = a.match(JustTagAttributes)
|
||||
keyword_args ||= {}
|
||||
keyword_args[matches[1]] = Expression.parse(matches[2])
|
||||
else
|
||||
filter_args << Expression.parse(a)
|
||||
end
|
||||
end
|
||||
result = [filter_name, filter_args]
|
||||
result << keyword_args unless keyword_args.empty?
|
||||
result << keyword_args if keyword_args
|
||||
result
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user