Skip to content

Replace LayoutStrategy buffered_bytes with a buffered bytes tracker - #8961

Merged
robert3005 merged 9 commits into
developfrom
rk/notodobytes
Jul 30, 2026
Merged

Replace LayoutStrategy buffered_bytes with a buffered bytes tracker#8961
robert3005 merged 9 commits into
developfrom
rk/notodobytes

Conversation

@robert3005

Copy link
Copy Markdown
Contributor

For file writing it's very useful to know how much data is already piped through
the writer. We have a CountingWriter but that can only measure flushed bytes. We
want to measure the bytes that the writer holds buferred.

Instead of recursive buffered_bytes which has numerous problems with stateless
strategies and double counting we add a bufferedbytestracker to the
layoutwritercontext and let writers report buffered bytes there

Comment thread vortex-file/src/writer.rs Outdated
Comment thread vortex-layout/src/strategy.rs Outdated
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Onur noted that constructing the writer's ArrayContext in `write_options`
froze the allowed encodings earlier than before, so an encoding registered
between `write_options()` and `write()` would be rejected. Split the
buffered-bytes counter out of `LayoutWriterContext` into a shareable
`BufferedBytesTracker`: the tracker is created with the options (so callers
can observe it before the write starts), while the `ArrayContext` is built
back in `write_internal`, restoring the previous snapshot point.

Also make buffered-bytes reporting a public API so out-of-tree layouts can
participate: `BufferedBytesTracker::reserve` hands out an RAII
`BufferedBytesReservation` that releases on drop, reachable from a strategy
via `LayoutWriterContext::reserve_buffered_bytes`.

Signed-off-by: "Robert Kruszewski" <robert@spiraldb.com>
Signed-off-by: Robert Kruszewski <github@robertk.io>
I, Robert Kruszewski <github@robertk.io>, hereby add my Signed-off-by to this commit: 45a4306

Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 enabled auto-merge (squash) July 30, 2026 15:28
I, Robert Kruszewski <github@robertk.io>, hereby add my Signed-off-by to this commit: 8311a80

Signed-off-by: Robert Kruszewski <github@robertk.io>
@robert3005
robert3005 merged commit ab2ac91 into develop Jul 30, 2026
76 checks passed
@robert3005
robert3005 deleted the rk/notodobytes branch July 30, 2026 15:51
@codspeed-hq

codspeed-hq Bot commented Jul 30, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 10.99%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

❌ 1 regressed benchmark
✅ 1883 untouched benchmarks
⏩ 12 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation fsl_large 88 µs 98.8 µs -10.99%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rk/notodobytes (aa8fd1c) with develop (81c36da)

Open in CodSpeed

Footnotes

  1. 12 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants