Description
Follow-up to #673. Reprofiling disproved that ticket's stated root cause
(Value::clone() is already cheap -- Rc-backed -- and read_full_scan
proves the shared column-decode path is at parity with oracle). The real
gap is isolated to read_join's inner-loop SeekRowid probes: roughly
78ns/row extra vs oracle for an identical join plan (SCAN bench_data /
SEARCH bench_lookup USING INTEGER PRIMARY KEY (rowid=?), verified via
EXPLAIN QUERY PLAN on both engines).
btree.rs::seek() was checked and already binary-searches within each
page, so the b-tree seek algorithm itself is not the gap. Two unconfirmed
candidates remain, both requiring actual measurement to distinguish:
- VDBE per-opcode dispatch overhead -- the join's inner loop runs more
opcodes per row (SeekRowid, ON-condition compare, jumps) than
read_full_scan's linear Next loop.
- Page-cache lookup overhead on the repeated per-seek page reads
(src/pager.rs:1221, RefCell<HashMap>-based cache) vs SQLite's
array-indexed pcache.
No profiler (perf/cargo-flamegraph) is available in the current
sandboxed dev environment, so this ticket's first deliverable is getting
one of those (or an equivalent manual instrumentation/counter-based
micro-benchmark) working, then using it to attribute the ~78ns/row gap
before proposing any fix.
Complexity
Estimate: small-medium
Reasoning: Mostly measurement/instrumentation work to attribute a
small per-iteration cost; only becomes a real implementation ticket once
the dominant cause is confirmed, at which point it may need re-scoping
again with its own estimate.
Acceptance Criteria
Refs: follow-up to #673
Description
Follow-up to #673. Reprofiling disproved that ticket's stated root cause
(
Value::clone()is already cheap --Rc-backed -- andread_full_scanproves the shared column-decode path is at parity with oracle). The real
gap is isolated to
read_join's inner-loopSeekRowidprobes: roughly78ns/row extra vs oracle for an identical join plan (
SCAN bench_data/SEARCH bench_lookup USING INTEGER PRIMARY KEY (rowid=?), verified viaEXPLAIN QUERY PLANon both engines).btree.rs::seek()was checked and already binary-searches within eachpage, so the b-tree seek algorithm itself is not the gap. Two unconfirmed
candidates remain, both requiring actual measurement to distinguish:
opcodes per row (
SeekRowid,ON-condition compare, jumps) thanread_full_scan's linearNextloop.(
src/pager.rs:1221,RefCell<HashMap>-based cache) vs SQLite'sarray-indexed pcache.
No profiler (
perf/cargo-flamegraph) is available in the currentsandboxed dev environment, so this ticket's first deliverable is getting
one of those (or an equivalent manual instrumentation/counter-based
micro-benchmark) working, then using it to attribute the ~78ns/row gap
before proposing any fix.
Complexity
Estimate: small-medium
Reasoning: Mostly measurement/instrumentation work to attribute a
small per-iteration cost; only becomes a real implementation ticket once
the dominant cause is confirmed, at which point it may need re-scoping
again with its own estimate.
Acceptance Criteria
documented as unavailable, with a fallback measurement approach)
read_joingap vs oracle is attributed to a specificcall site (opcode dispatch vs page-cache lookup vs something else),
with numbers to back it
re-scoped as its own ticket with its own complexity estimate rather
than implemented inline here
Refs: follow-up to #673