Reduce directory override lookup overhead during proxy startup
overrides_by_dir() opens and keeps a handle for every saved directory override. I tried checking overrides one at a time and dropping each handle after comparison.
below i attached the benchmark for both release build through proxy using dumy rustc .
| Overrides | Current | Temporary change |
|---|---|---|
| 0 | 5.2 ms | 5.5 ms |
| 10 | 5.4 ms | 5.4 ms |
| 50 | 5.5 ms | 5.5 ms |
| 100 | 13.1 ms | 5.7 ms |
| 200 | 23.3 ms | 5.9 ms |
| 500 | 35.0 ms | 6.7 ms |
| 1,000 | 46.8 ms | 8.2 ms |
with 100 overrides and a 64-file-descriptor limit, the current code also missed a matching override. the temporary change selected it correctly.
this change still compares directory identity using filesystem handles, preserving the behavior introduced in #5113.
is it reasonable to do it?
https://github.com/rust-lang/rustup/pull/5232
mb did not taken a look at it :( i worked on older checkout