Skip to content

perf(worktree): write checkouts in parallel, durably - #101

Open
PiquelChips wants to merge 1 commit into
feat/workspaces-indexfrom
feat/workspaces-durable-checkouts
Open

PiquelChips wants to merge 1 commit into
feat/workspaces-indexfrom
feat/workspaces-durable-checkouts

Conversation

@PiquelChips

Copy link
Copy Markdown
Member

A checkout wrote its files one at a time, creating each one's directory on the way, and left them in the page cache: a crash could leave the working copy pointing at a revision whose files never reached the disk.

Checkouts now:

  • create the directories first, then write the files in parallel, a contiguous run per core. That keeps threads off each other's directory locks, and is 40% faster than handing files out one at a time.
  • make the files, and the directories whose entries changed, durable with one batch sync before they return.
  • sync the first half of a large checkout in the background while they write the second half, so the final barrier has less left to wait for.

Benchmark: the new workspace benchmark checks a 20,000-file tree out into an empty directory. It takes about 260 ms, most of it the durable sync: ext4 needs about 190 ms just to write the files back.

Note

Written by Claude Opus 5.5 in Claude Code (via T3 Code)

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 34 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: aa3b1584-528b-4ce3-8602-5b2e957768b5
Commits

Reviewing files that changed from the base of the PR and between c1c3e53 and ab12a78.

Files selected for processing: 4

  • apps/origin-src/Cargo.toml
  • apps/origin-src/benches/workspace.rs
  • apps/origin-src/src/workspace/mod.rs
  • apps/origin-src/src/worktree.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@PiquelChips
PiquelChips added this pull request to stack #165 November 22, 2026 14:59
@PiquelChips
PiquelChips force-pushed the feat/workspaces-durable-checkouts branch from 6c7a163 to b8cfb04 Compare November 22, 2026 18:54
A checkout wrote its files one at a time, creating each one's directory
on the way, and left them to the page cache: a crash could leave a
working copy pointing at a revision whose files never reached the disk.

Checkouts now create the directories first, then write the files in
parallel, a contiguous run per core, which keeps threads off each
other's directory locks and is 40% faster than handing files out one at
a time. They are durable, with one batch sync of the files and the
directories whose entries changed, before the checkout returns. A large
checkout syncs its first half in the background while it writes the
second, so the final barrier has less left to wait for.

The `workspace` benchmark checks a 20,000-file tree out into an empty
directory.
@PiquelChips
PiquelChips force-pushed the feat/workspaces-durable-checkouts branch from b8cfb04 to ab12a78 Compare November 22, 2026 19:20
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.

1 participant