Skip to content

bench: add fixed-width variant to the fair PK comparison - #358

Merged
MPCoreDeveloper merged 2 commits into
masterfrom
bench/pk-fixedwidth
Sep 2, 2026
Merged

bench: add fixed-width variant to the fair PK comparison#358
MPCoreDeveloper merged 2 commits into
masterfrom
bench/pk-fixedwidth

Conversation

@MPCoreDeveloper

Copy link
Copy Markdown
Owner

Summary

The fair PK comparison (--pk) now also runs SharpCoreDB with the fixed-width record layout (FixedWidthRecordLayout=true) on the same id INTEGER PRIMARY KEY schema, so the layout's effect is measured head-to-head with the legacy variable-length layout and SQLite.

Measured (AppendOnly, 1 run, this machine)

DB INSERT READ UPDATE DELETE
SharpCoreDB legacy 87K 63K 41K 65K
SharpCoreDB fixed-width 128K (+46%) 74K 51K (+23%) 75K
SQLite 124K 89K 261K 353K
  • UPDATE gap vs SQLite: 6.3× → 5.1×
  • DELETE gap vs SQLite: 5.4× → 4.7×

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).

MPCoreDeveloper 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.
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit fa6f235 into master Sep 2, 2026
13 checks passed
@MPCoreDeveloper
MPCoreDeveloper deleted the bench/pk-fixedwidth branch September 2, 2026 20:42
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