Skip to content

perf(delete): drop per-key B-tree probe & bulk-delete PK on the FW contiguous path (M3) - #382

Merged
MPCoreDeveloper merged 1 commit into
masterfrom
perf/fw-delete-core
Sep 4, 2026
Merged

perf(delete): drop per-key B-tree probe & bulk-delete PK on the FW contiguous path (M3)#382
MPCoreDeveloper merged 1 commit into
masterfrom
perf/fw-delete-core

Conversation

@MPCoreDeveloper

Copy link
Copy Markdown
Owner

Samenvatting

FW contigu pad (B8/B9): per-key B-tree probe vervangen door decode-verificatie + DeleteBulk.

De gedeelde contiguous-probe resolved elke key met één Index.Search (~10K searches per
10K-row batch) en de FW-DELETE verwijderde de PK-entry's daarna één Delete per key — samen
~20K boomoperaties per batch. Nu:

  • de probe lokaliseert alleen de eerste key via de boom,
  • de overige posities volgen uit de fixed-width stride,
  • de span wordt één keer gelezen en elke record geverifieerd op lengte-prefix én gedecodeerde
    PK-slot (gelijk aan de batch-key) — dezelfde batches vallen terug als voorheen (gaps/tombstones
    → prefix-mismatch; afwijkende PK → fallback), en er wordt niets gemuteerd vóór de hele span
    bewezen geldig is;
  • de delete verwijdert de PK-entry's met één DeleteBulk.

Metingen (fair-PK median-of-3, sequenced, zelfde machine)

Operatie master (#381) deze branch SQLite-ratio master → branch
FW UPDATE 212.3K ops/s 245.3K ops/s ~0.78x → ~0.82x
FW DELETE 155.0K ops/s 171.6K ops/s ~2.6x gap → ~2.1x gap
legacy DELETE 93.7K ops/s 119.0K ops/s ~4.3x gap → ~3.0x gap
legacy UPDATE 125.5K ops/s 129.8K ops/s ~0.44x → ~0.44x

Let op: INSERT/READ (onveranderde paden) varieerden tussen de twee median-runs met ±10-20% —
er blijft omgevingsruis op deze machine; de SQLite-ratio binnen elke run is daardoor de meest
betrouwbare maat. Richting is consistent positief op alle DELETE/UPDATE-ratio's.

Validatie

  • Full suite: 1766 tests, 0 failed (Release).
  • Bestaande FW-regressietests (contiguous/gapped/descending, incl. reopen) dekken de nieuwe
    probe-verificatie af.

…ntiguous path

The shared B8/B9 contiguous probe resolved every key with one Index.Search and
then TryBulkDeleteContiguousFixedWidth removed the PK entries one Delete at a
time — ~20K B-tree operations per 10K-row fixed-width batch. The probe now
locates only the FIRST key through the tree, computes the remaining positions
by the fixed-width stride, reads the contiguous span once and verifies every
record by its length prefix AND its decoded fixed-width PK slot (equal to the
batch key); the delete removes the PK entries with one DeleteBulk pass. The
verification rejects exactly the batches the old per-key search rejected
gaps/tombstones surface as prefix mismatches, a differing PK falls back like a
tree miss), so nothing is modified before the whole span is proven valid.

Fair-PK median-of-3 (sequential, uncontended): fixed-width UPDATE ~245K,
DELETE ~172K ops/s vs ~138-164K/~120-156K in the earlier single-shot runs.
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@MPCoreDeveloper
MPCoreDeveloper merged commit 31ac270 into master Sep 4, 2026
13 checks passed
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