You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow-up bench from PR #1228 review (item 3 in coverage gaps). The 200× ORDER BY ?label LIMIT speedup (memory: mem:fact-01kkq57f5xpx815scy9fsb6jzr) depends on the lex_sorted_string_ids flag being preserved through bulk import + the first post-import write. A regression here would silently regress production ORDER BY queries on freshly imported datasets — the failure mode is "code still runs, query just gets slow," which is exactly the class the gate exists to catch.
Scope
Add fluree-db-api/benches/query_orderby_strings.rs (alternatively rolled into import_bulk.rs as a follow-up scenario, but a separate file is cleaner). Specifically:
Setup: bulk-import a dataset with string-typed predicate values that exercise the lex-sorted-strings fast path. Use gen::people or gen::bsbm (whichever's distribution stresses it best) — pick deterministically so the baseline is stable.
Two scenarios:
orderby_freshly_imported: ORDER BY ?label LIMIT N immediately after a bulk import (the lex_sorted_string_ids flag should still be set).
orderby_after_first_write: same query, but after a single post-import write txn (which clears the flag per the invariant doc). The bench documents the latency cliff so a regression that fails to clear the flag AND a regression that clears it prematurely are both visible.
Throughput metric: ns/query or rows/sec (criterion default vs. Throughput::Elements).
Use the chassis pattern.bench_runtime(), current_profile(), current_scale(), next_ledger_alias().
Register a budget in regression-budget.json. Tighten the budget on the post-import scenario specifically — that's the one most prone to silent regression.
Acceptance
Bench compiles and runs --test green at tiny scale.
regression-budget.json has an entry.
Both scenarios show clearly-different latencies in a manual cargo bench run (verifies the bench is actually exercising the flag-driven path, not just measuring noise).
BENCHMARKING.md's "Current benches" table gets a row.
Memory: mem:fact-01kkq57f5xpx815scy9fsb6jzr (lex-sorted-strings ORDER BY 200× speedup).
Adjacent bench: import_bulk.rs covers the import side; this bench covers the consequence on subsequent reads.
Out of scope
The deeper correctness invariant (when should the flag be set/cleared) is the subject of existing tests. This bench is purely about catching perf regressions that flip a known fast-path off.
Context
Follow-up bench from PR #1228 review (item 3 in coverage gaps). The 200× ORDER BY ?label LIMIT speedup (memory:
mem:fact-01kkq57f5xpx815scy9fsb6jzr) depends on thelex_sorted_string_idsflag being preserved through bulk import + the first post-import write. A regression here would silently regress production ORDER BY queries on freshly imported datasets — the failure mode is "code still runs, query just gets slow," which is exactly the class the gate exists to catch.Scope
Add
fluree-db-api/benches/query_orderby_strings.rs(alternatively rolled intoimport_bulk.rsas a follow-up scenario, but a separate file is cleaner). Specifically:gen::peopleorgen::bsbm(whichever's distribution stresses it best) — pick deterministically so the baseline is stable.orderby_freshly_imported: ORDER BY ?label LIMIT N immediately after a bulk import (thelex_sorted_string_idsflag should still be set).orderby_after_first_write: same query, but after a single post-import write txn (which clears the flag per the invariant doc). The bench documents the latency cliff so a regression that fails to clear the flag AND a regression that clears it prematurely are both visible.Throughput::Elements).bench_runtime(),current_profile(),current_scale(),next_ledger_alias().regression-budget.json. Tighten the budget on the post-import scenario specifically — that's the one most prone to silent regression.Acceptance
--testgreen attinyscale.regression-budget.jsonhas an entry.cargo benchrun (verifies the bench is actually exercising the flag-driven path, not just measuring noise).BENCHMARKING.md's "Current benches" table gets a row.References
#3.mem:fact-01kkq57f5xpx815scy9fsb6jzr(lex-sorted-strings ORDER BY 200× speedup).import_bulk.rscovers the import side; this bench covers the consequence on subsequent reads.Out of scope
The deeper correctness invariant (when should the flag be set/cleared) is the subject of existing tests. This bench is purely about catching perf regressions that flip a known fast-path off.