| For each puppet resource type, e.g. file, the autoloader will attempt to load all providers for that type. The autoloader's loadall method will glob each directory in its autoloader search pat looking for files of the form puppet/provider/<type>. In a dev/bundler setup with no module there are about 100 directories to scan due to gems, etc. The files_to_load method will return a list of relative paths, e.g. puppet/provider/type/file/posix.rb. The autoloader will then call load_file to load the file using it's relative path. The autoloader then searches the entire search space again! So we've got an O^2 thing going on. The autoloader should preserve the absolute path of the provider it globbed, and try to load that file, instead of searching for it again. Making that change reduced the number of stat64 calls from 1515 to 1146, so 25% less. |