Skip to content

perf(fspy): use sparse Windows shared memory#525

Closed
wan9chi wants to merge 1 commit into
windows-shm-backendfrom
windows-sparse-shm
Closed

perf(fspy): use sparse Windows shared memory#525
wan9chi wants to merge 1 commit into
windows-shm-backendfrom
windows-sparse-shm

Conversation

@wan9chi

@wan9chi wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member

Motivation

Avoid allocating a fully backed 4 GiB temporary file for every tracked task on Windows.

Background

The parity backend deliberately retains the previous file-backed resource model. Marking that file sparse allows the logical mapping to remain 4 GiB while physical allocation follows the small prefix actually used by fspy records.

Changes

  • Creates the owner backing file as temporary and delete-on-close.
  • Calls FSCTL_SET_SPARSE before extending the file.
  • Falls back to ordinary sizing for filesystems that explicitly report sparse files as unsupported.
  • Continues to propagate access-denied, invalid-parameter, and other unexpected sparse setup errors.
  • Opens sender views directly through the decoded named mapping without reopening or recomputing the backing path.
  • Orders owner fields so the view, mapping handle, and backing file close safely.
  • Adds logical-versus-allocated-size, endpoint allocation, sparse fallback, hard-error, direct-open, changed-environment, and cleanup coverage.
  • Adds the Windows performance changelog entry.

wan9chi commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@wan9chi wan9chi changed the base branch from windows-shm-backend to graphite-base/525 July 9, 2026 05:12
@wan9chi wan9chi force-pushed the graphite-base/525 branch from 42992a3 to fcc530f Compare July 9, 2026 05:13
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 2ee5a9c to a7e9506 Compare July 9, 2026 05:13
@wan9chi wan9chi changed the base branch from graphite-base/525 to windows-shm-backend July 9, 2026 05:13
@wan9chi wan9chi changed the base branch from windows-shm-backend to graphite-base/525 July 9, 2026 05:22
@wan9chi wan9chi force-pushed the graphite-base/525 branch from fcc530f to 5d1ba2f Compare July 9, 2026 05:23
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from a7e9506 to 41e4c55 Compare July 9, 2026 05:23
@wan9chi wan9chi changed the base branch from graphite-base/525 to windows-shm-backend July 9, 2026 05:23
@wan9chi wan9chi changed the base branch from windows-shm-backend to graphite-base/525 July 9, 2026 05:28
@wan9chi wan9chi force-pushed the graphite-base/525 branch from 5d1ba2f to 51f4393 Compare July 9, 2026 05:29
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 41e4c55 to 4190b5e Compare July 9, 2026 05:29
@wan9chi wan9chi changed the base branch from graphite-base/525 to windows-shm-backend July 9, 2026 05:29
@wan9chi wan9chi changed the base branch from windows-shm-backend to graphite-base/525 July 9, 2026 05:35
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 4190b5e to b38ebb3 Compare July 9, 2026 05:36
@wan9chi wan9chi force-pushed the graphite-base/525 branch from 51f4393 to adc5221 Compare July 9, 2026 05:36
@wan9chi wan9chi changed the base branch from graphite-base/525 to windows-shm-backend July 9, 2026 05:36
@wan9chi wan9chi marked this pull request as ready for review July 9, 2026 05:42

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b38ebb3d06

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/fspy_shm/src/windows/mod.rs Outdated
@wan9chi wan9chi changed the base branch from windows-shm-backend to graphite-base/525 July 9, 2026 07:57
@wan9chi wan9chi force-pushed the graphite-base/525 branch from adc5221 to 39b502d Compare July 9, 2026 07:58
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from b38ebb3 to daf99c3 Compare July 9, 2026 07:58
@wan9chi wan9chi changed the base branch from graphite-base/525 to windows-shm-backend July 9, 2026 07:58
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 39b502d to 29bdc15 Compare July 9, 2026 14:17
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 29bdc15 to 9bcba8e Compare July 10, 2026 06:03
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from a9b45dc to 0de39b7 Compare July 10, 2026 06:03
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 9bcba8e to 62be316 Compare July 10, 2026 06:57
@wan9chi wan9chi force-pushed the windows-sparse-shm branch 2 times, most recently from 6df5e61 to 91edb14 Compare July 10, 2026 07:04
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 62be316 to 283d922 Compare July 10, 2026 07:04
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 91edb14 to fd848aa Compare July 10, 2026 07:14
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 283d922 to 6691051 Compare July 10, 2026 07:14
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from fd848aa to c21af71 Compare July 10, 2026 07:27
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 6691051 to 033dbe6 Compare July 10, 2026 07:27
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from c21af71 to 7047470 Compare July 10, 2026 08:12
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 033dbe6 to 079c1af Compare July 10, 2026 08:12
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 7047470 to eeceb2e Compare July 10, 2026 09:41
@wan9chi wan9chi force-pushed the windows-shm-backend branch 2 times, most recently from 2fb905b to 83d2b75 Compare July 10, 2026 10:39
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from eeceb2e to 52690ed Compare July 10, 2026 10:39
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 83d2b75 to f3a5ac6 Compare July 10, 2026 10:57
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 52690ed to 8bb2b67 Compare July 10, 2026 10:57
@wan9chi wan9chi force-pushed the windows-shm-backend branch from f3a5ac6 to e7205e0 Compare July 10, 2026 11:03
@wan9chi wan9chi force-pushed the windows-sparse-shm branch 2 times, most recently from 2f24313 to bc90566 Compare July 10, 2026 11:16
@wan9chi wan9chi force-pushed the windows-shm-backend branch from e7205e0 to 1161f5b Compare July 10, 2026 11:16
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from bc90566 to 38adc89 Compare July 10, 2026 11:21
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 1161f5b to ddfb5f3 Compare July 10, 2026 11:21
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from 38adc89 to dafca75 Compare July 10, 2026 11:26
@wan9chi wan9chi force-pushed the windows-shm-backend branch from ddfb5f3 to 13bda67 Compare July 10, 2026 11:26
Co-authored-by: GPT-5.6 <gpt-5.6@openai.com>

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wan9chi wan9chi force-pushed the windows-sparse-shm branch from dafca75 to cc20cc0 Compare July 10, 2026 11:33
@wan9chi wan9chi force-pushed the windows-shm-backend branch from 13bda67 to 45c8d2f Compare July 10, 2026 11:33
@wan9chi wan9chi closed this Jul 10, 2026
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