Skip to content

perf(fs): count folder sizes with one stat per entry on several threads - #268

Merged
ItsLemmy merged 2 commits into
noctalia-dev:mainfrom
iamnitesh108:perf/folder-totals-walk
Dec 1, 2026
Merged

ItsLemmy merged 2 commits into
noctalia-dev:mainfrom
iamnitesh108:perf/folder-totals-walk

Conversation

@iamnitesh108

@iamnitesh108 iamnitesh108 commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Folder sizes are counted much faster: a folder with nearly two million items now takes under a second instead of about ten. The results are the same as before.

Motivation

On large folders the size took many seconds to appear and kept one core busy the whole time. Large folders are now counted on a few cores, using about the same total CPU as before. Small folders and network mounts still use one.

Type of Change

  • Refactoring

Testing

  • just test passes except system-mounts, transfer-service and transfer-service-without-rename-flags, which fail the same way on main.
  • New tests cover exact totals and item limits on a tree large enough to use several threads, cancelling, and a subfolder renamed during the count.
  • Thread and address sanitizer runs of the folder totals test are clean.
  • Benchmark on a warm cache, with the new luciole-folder-totals-bench:
Folder Before After diskus (same thread count)
1.85 million items 10.5 s 0.79 s 1.04 s
2.1 million items 13.7 s 1.34 s 1.56 s

Checklist

  • This PR is ready for review, or it is marked as Draft.
  • This change fits SCOPE.md, or its scope was agreed in an issue or on Discord first.
  • I read and followed the relevant guidance in CONTRIBUTING.md.
  • I ran just format, or this PR has no C++ changes.
  • I ran just lint and the relevant build or test commands, or explained why they were not run.
  • I ran just role-alpha-check, or this PR does not change UI colors.
  • I tested the change in a running Luciole where automated checks are insufficient.
  • I self-reviewed the changes.
  • I checked for new warnings or errors.
  • I updated docs/, or this PR does not change user-facing behavior or settings.
  • I used canonical names for settings, paths, and identifiers.

@iamnitesh108
iamnitesh108 marked this pull request as ready for review November 30, 2026 18:04

@talia-ci talia-ci Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talia preliminary review

Check Result
Merge score 🟢 4/5 — No issues found; likely ready after CI and human review
Findings None found
Review depth 3/5 — how thoroughly the changed code could be checked by reading it
Coverage 8 of 8 changed files reviewed

What Talia checked: Inspected the new parallel walk (per-root device/scope state, per-thread tallies, queue/helper lifecycle, OpenFolder change accounting and member destruction order), its callers (FolderTotalsService, transfer_estimate) and new tests. Concurrency reasoning found no concrete defect; runtime/TSan behavior could not be executed, which is the main residual uncertainty.

Run details
  • Commit reviewed: 967d461
  • Source lookups: 30 file reads, 28 searches
  • Prompt version: 859b7490ca3d

Preliminary automated review: Talia read the changed code and related source; nothing was built, run or tested, and AI can make mistakes. It is not a scope acceptance or a promise to merge; a human reviewer makes the final call. See our ethos.

@ItsLemmy
ItsLemmy merged commit 27412b3 into noctalia-dev:main Dec 1, 2026
2 checks passed
@ItsLemmy

ItsLemmy commented Dec 1, 2026

Copy link
Copy Markdown
Member

Looks good, thx.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants