Skip to content

Commit b814e79

Browse files
committed
Avoid searching for files in nonexistant dirs
Search paths are determined by appending the specified dir to each directory in the load_paths. Though each dir in load_paths should exist, when a dir is specified, most load_paths dirs probably don't include it. For each dir we skip in this way (requiring one stat through File.directory?) we save 16 stat calls (2 possible prefixes, and 8 possible extensions) looking for files.
1 parent 7d46f6c commit b814e79

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/sassc/rails/importer.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ def imports(path, parent_path)
100100
search_paths.map! do |path|
101101
File.join(path, specified_dir)
102102
end
103+
search_paths.select! do |path|
104+
File.directory?(path)
105+
end
103106
end
104107

105108
search_paths.each do |search_path|

0 commit comments

Comments
 (0)