Registry Mirror
Skip to content

Conversation

@vbreuss

@vbreuss vbreuss commented Nov 28, 2026

Copy link
Copy Markdown
Member

Moving a directory looked up the children of every moved directory with EnumerateLocations, which scans all containers, sorts all descendants with OrderBy and only then skips the nested ones. In a profile of moving a directory with 10 subdirectories of 10 files, this lookup took almost half of the time.

GetDirectChildren now keeps only the direct children while scanning and sorts just those, with the same stable OrderBy, so the order of the moved entries and of their notifications stays the same. It also releases closed safe file handles first, like EnumerateLocations. Comparing it with the previous lookup for every directory of 1,200 random trees on the native and the simulated Linux, macOS and Windows file systems gave the same entries in the same order.

In a local measurement, moving the directory allocated 315 KB instead of 358 KB.

@vbreuss vbreuss self-assigned this Nov 28, 2026
@vbreuss
vbreuss added this pull request to stack #1255 November 28, 2026 16:17
@mergify

mergify Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge; no actionable issues were found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

The PR adds GetDirectChildren and uses it when moving directories.

  • Directory moves find and sort only their direct children.

Reviews (1) · Last reviewed commit: "perf: find only the direct children of a..." · Reviewed by Greptile

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Test Results

     80 files  ±0       80 suites  ±0   1h 37m 45s ⏱️ +49s
 88 648 tests  - 1   83 928 ✅  - 1   4 720 💤 ±0  0 ❌ ±0 
205 254 runs  ±0  185 316 ✅ ±0  19 938 💤 ±0  0 ❌ ±0 

Results for commit 3985780. ± Comparison against base commit a4ebb82.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

🚀 Benchmark Results

Compared to main, which ran on the same runner. Times that change by more than 10% are marked.

Memory

Benchmark main PR Δ
Initialize (N=100) 449,707 B 457,747 B 🔴 +8,040 B (+2%)
RoundTrip (Size=65536) 414,037 B 414,022 B 🟢 -15 B (±0%)
MoveTree 496,075 B 303,525 B 🟢 -192,550 B (-39%)

Time

Benchmark main PR Δ
Initialize (N=10) 46.68 μs 36.80 μs 🟢 -21%
RoundTrip (Size=1024) 11.58 μs 10.03 μs 🟢 -13%
MoveTree 1.10 ms 650.69 μs 🟢 -41%
Enumerate (N=10&Pattern=*) 5.08 μs 3.68 μs 🟢 -28%
CompleteTestBenchmarks
Complete Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 51.69 μs 1.476 μs 1.233 μs 1.00 89.38 KB 1.00
SystemIOAbstractions 51.34 μs 0.692 μs 0.647 μs 0.99 166.7 KB 1.87
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.53GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

InitializationBenchmarks
Initialize N Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 10 36.80 μs 1.134 μs 1.005 μs 1.00 56.63 KB 1.00
SystemIOAbstractions 10 29.57 μs 0.690 μs 0.645 μs 0.80 48.59 KB 0.86
Testably 100 301.69 μs 4.273 μs 3.568 μs 1.00 447.02 KB 1.00
SystemIOAbstractions 100 249.29 μs 5.600 μs 4.964 μs 0.83 392.78 KB 0.88
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
INTEL XEON PLATINUM 8573C 0.80GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

MockCreationBenchmarks
CreateMock Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 3.232 μs 0.0305 μs 0.0270 μs 1.00 7.41 KB 1.00
SystemIOAbstractions 5.170 μs 0.0277 μs 0.0259 μs 1.60 8.15 KB 1.10
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 3.24GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  IterationCount=15  
LaunchCount=1  WarmupCount=10  

FileRoundTripBenchmarks
RoundTrip Size Mean Error StdDev Median Ratio Allocated Alloc Ratio
Testably 1024 10.035 μs 2.3019 μs 2.1532 μs 9.956 μs 1.04 12.34 KB 1.00
SystemIOAbstractions 1024 6.878 μs 4.0278 μs 3.7677 μs 4.936 μs 0.72 16.54 KB 1.34
Testably 65536 146.760 μs 3.8003 μs 3.5548 μs 147.889 μs 1.00 404.32 KB 1.00
SystemIOAbstractions 65536 56.527 μs 0.4387 μs 0.4103 μs 56.666 μs 0.39 408.49 KB 1.01
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V74 2.60GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=4096  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

FileInfoBenchmarks
Inspect Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 2,012.6 ns 122.70 ns 114.78 ns 1.00 2.79 KB 1.00
SystemIOAbstractions 931.6 ns 5.06 ns 4.23 ns 0.46 2.55 KB 0.92
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.50GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=65536  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

FileStreamBenchmarks
Chunks Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 52.00 μs 3.542 μs 3.140 μs 1.00 209.22 KB 1.00
SystemIOAbstractions 83.30 μs 0.925 μs 0.866 μs 1.61 326.67 KB 1.56
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.71GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=2048  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

DirectoryTreeBenchmarks
MoveTree Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 650.69 μs 14.818 μs 13.136 μs 1.00 296.41 KB 1.00
SystemIOAbstractions 63.14 μs 0.226 μs 0.176 μs 0.10 106.62 KB 0.36
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.76GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=512  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

Enumeration10Benchmarks
Enumerate N Pattern Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 10 ***** 3.676 μs 0.0229 μs 0.0179 μs 1.00 5.56 KB 1.00
SystemIOAbstractions 10 * 3.157 μs 0.0536 μs 0.0448 μs 0.86 3.93 KB 0.71
Testably 10 *.txt 3.863 μs 0.0142 μs 0.0119 μs 1.00 5.25 KB 1.00
SystemIOAbstractions 10 *.txt 4.824 μs 0.0539 μs 0.0478 μs 1.25 4.24 KB 0.81
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 9V45 4.55GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v4

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=16384  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

Enumeration1000Benchmarks
Enumerate N Pattern Mean Error StdDev Ratio Allocated Alloc Ratio
Testably 1000 ***** 887.2 μs 6.09 μs 5.40 μs 1.00 318.94 KB 1.00
SystemIOAbstractions 1000 * 415.5 μs 3.44 μs 3.05 μs 0.47 70.42 KB 0.22
Testably 1000 *.txt 901.7 μs 1.77 μs 1.57 μs 1.00 284.19 KB 1.00
SystemIOAbstractions 1000 *.txt 743.0 μs 8.57 μs 7.60 μs 0.82 66.87 KB 0.24
BenchmarkDotNet v0.15.8, Linux Ubuntu 26.04.1 LTS (Resolute Raccoon)
AMD EPYC 7763 2.75GHz, 1 CPU, 4 logical and 2 physical cores
.NET SDK 11.0.100
  [Host] : .NET 10.0.15 (10.0.15, 10.0.1526.53008), X64 RyuJIT x86-64-v3

Job=InProcess  Toolchain=InProcessEmitToolchain  InvocationCount=512  
IterationCount=15  LaunchCount=1  UnrollFactor=1  
WarmupCount=10  

@vbreuss
vbreuss force-pushed the perf/move-direct-children branch from 3985780 to fb9aee4 Compare November 28, 2026 19:46
@vbreuss
vbreuss enabled stacked auto-merge (squash) November 28, 2026 19:57
@sonarqubecloud

Copy link
Copy Markdown

@vbreuss
vbreuss merged commit 79fcd07 into main Nov 28, 2026
25 checks passed
@vbreuss
vbreuss deleted the perf/move-direct-children branch November 28, 2026 22:30
github-actions Bot added a commit that referenced this pull request Nov 29, 2026
github-actions Bot added a commit that referenced this pull request Nov 29, 2026
@github-actions

Copy link
Copy Markdown

This is addressed in release v8.1.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant