Reduce allocations from rendering item as liquid (#8406)

Merge pull request 8406
This commit is contained in:
Ashwin Maroli 2020-11-11 16:08:03 +05:30 committed by GitHub
parent 9de60bbf48
commit 054d9356b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -462,8 +462,7 @@ module Jekyll
def as_liquid(item) def as_liquid(item)
case item case item
when Hash when Hash
pairs = item.map { |k, v| as_liquid([k, v]) } item.each_with_object({}) { |(k, v), result| result[as_liquid(k)] = as_liquid(v) }
Hash[pairs]
when Array when Array
item.map { |i| as_liquid(i) } item.map { |i| as_liquid(i) }
else else