Skip to content

Commit bb52086

Browse files
committed
Avoid building full path objects when cached
1 parent 4db7ae5 commit bb52086

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

actionview/lib/action_view/template/resolver.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,12 @@ def all_template_paths # :nodoc:
122122

123123
private
124124
def _find_all(name, prefix, partial, details, key, locals)
125-
path = TemplatePath.build(name, prefix, partial)
126125
requested_details = key || TemplateDetails::Requested.new(**details)
127-
query(path, requested_details, locals, cache: !!key)
128-
end
129-
130-
def query(path, requested_details, locals, cache:)
131-
cache = cache ? @unbound_templates : Concurrent::Map.new
126+
cache = key ? @unbound_templates : Concurrent::Map.new
132127

133128
unbound_templates =
134-
cache.compute_if_absent(path.virtual) do
129+
cache.compute_if_absent(TemplatePath.virtual(name, prefix, partial)) do
130+
path = TemplatePath.build(name, prefix, partial)
135131
unbound_templates_from_path(path)
136132
end
137133

0 commit comments

Comments
 (0)