I'm benchmarking oxfmt on a big repo with around 50k directories. Running it through samply reveals that the majority of time is spent calling fs::metadata on many places. The project has a single .oxfmtrc.json at the root. Running it with --disable-nested-config sidesteps the issue and is a current workaround.
| Mode |
Time |
| default |
6.1s |
--disable-nested-config |
2.5s |
So far I have traced it down to prescan_config_locations() as the key issue. It runs a sequential walk over every directory before the parallel main walk starts. For each directory it calls 3 separate fs::metadata / path.is_file() calls.
|
for path in [ |
|
dir.join(self.config_file_names.json), |
|
dir.join(self.config_file_names.jsonc), |
|
dir.join(self.config_file_names.js), |
|
] { |
Default:
With --disable-nested-config:

I'm benchmarking
oxfmton a big repo with around 50k directories. Running it through samply reveals that the majority of time is spent callingfs::metadataon many places. The project has a single.oxfmtrc.jsonat the root. Running it with--disable-nested-configsidesteps the issue and is a current workaround.--disable-nested-configSo far I have traced it down to
prescan_config_locations()as the key issue. It runs a sequential walk over every directory before the parallel main walk starts. For each directory it calls 3 separatefs::metadata/path.is_file()calls.oxc/crates/oxc_config/src/discovery.rs
Lines 117 to 121 in dd88726
Default:
With
--disable-nested-config: