bench: add fixed-width variant to the fair PK comparison - #358
Merged
Conversation
added 2 commits
September 2, 2026 22:36
--pk now runs SharpCoreDB legacy variable-length AND fixed-width (FixedWidthRecordLayout) on the id-PK schema vs SQLite. Measured (AppendOnly, 1 run): fixed-width INSERT +46%, UPDATE +23%, DELETE +16% vs legacy; UPDATE gap vs SQLite narrows 6.3x -> 5.1x. Evidence that fixed-width-by-default alone does not close the residual per-row gap.
…s opt-out) DatabaseConfig.AutoFixedWidthRecords (default true, landed in perf/fixedwidth-default) makes new PK tables fixed-width; the --pk legacy arm now opts out so the comparison keeps measuring the legacy layout against the fixed-width arm.
MPCoreDeveloper
force-pushed
the
bench/pk-fixedwidth
branch
from
September 2, 2026 20:36
6d64256 to
16e04dd
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
The fair PK comparison (
--pk) now also runs SharpCoreDB with the fixed-width record layout (FixedWidthRecordLayout=true) on the sameid INTEGER PRIMARY KEYschema, so the layout's effect is measured head-to-head with the legacy variable-length layout and SQLite.Measured (AppendOnly, 1 run, this machine)
Interpretation
Fixed-width gives a real, broad win (+46% INSERT, +23% UPDATE, +16-18% READ/DELETE) but does not close the residual ~5× UPDATE/DELETE gap on this workload. The same-length
SET score = …update was already in-place on the legacy layout (0 file growth); the residual cost is the per-row read-modify-write + index maintenance + resolution path, not the record encoding. This data informs whether to (a) land fixed-width-by-default for new PK'd columnar tables (worth +23-46%, but changes the default on-disk encoding for new tables) and/or (b) target the per-row cost (managed page cache / batch row reads).