On 15 Dec 2015 4:15 pm, "Eli Zaretskii" wrote: > > Maybe I'm reading the code wrongly, but it looks like even before the > cache could kick in, dir-locals-find-file calls > locate-dominating-file, passing it dir-locals--all-files as its > predicate. This has 2 effects: (a) it loads "seq", and (b) it calls > file-expand-wildcards, which needs to read the entire directory and > then match each file against a regexp. > > Could these be the cause of slowdown? Probably. And no, You're not reading it wrong. We need to locate the dir locals file(s) in order to compare its timestamp to the cache. Do we have a faster way of expanding wildcards? Maybe it would be faster to not allow wildcards at all, and just have a fixed regexp that we use in directory-files. If that doesn't help, then we could also forgo of the regexp, and just have two allowed filenames (like .dir-locals.el and .dir-locals-2.el).