mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-12 23:40:45 -07:00
Use EMPTY_ARRAY for empty static_environments in Context — avoids 60 array allocs per render cycle\n\nResult: {"status":"keep","combined_µs":4262,"parse_µs":3079,"render_µs":1183,"allocations":25535}
This commit is contained in:
@@ -28,6 +28,8 @@ module Liquid
|
||||
|
||||
@static_environments = if static_environments.is_a?(Array)
|
||||
static_environments.frozen? ? static_environments : static_environments.freeze
|
||||
elsif static_environments.empty?
|
||||
Const::EMPTY_ARRAY
|
||||
else
|
||||
[static_environments].freeze
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user