提交 295a7fd1 编写于 作者: A Aaron Patterson

hash on the template directory in order to improve cache hits

上级 94040409
......@@ -132,10 +132,11 @@ def find_templates(name, prefix, partial, details)
def query(path, details, formats)
query = build_query(path, details)
templates = []
sanitizer = Hash.new { |h,k| h[k] = Dir["#{File.dirname(k)}/*"] }
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }
Dir[query].each do |template|
next if File.directory?(template) || !sanitizer[template].include?(template)
next if File.directory?(template)
next unless sanitizer[File.dirname(template)].include?(template)
handler, format = extract_handler_and_format(template, formats)
contents = File.binread template
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册