Datastore query binary search + SPDX/CI hygiene#104
Merged
Conversation
ARCHITECTURE.md documents both as binary searches, but findFirstValid() and latestAt() linear-scanned the chunk deque and the rows within a chunk (O(C*R)). Committed chunks are never empty and are time-ordered (each chunk's t_min >= the previous chunk's t_max), so t_min/t_max are monotonic across the deque and timestamps are monotonic within a chunk -- enabling std::lower_bound / std::upper_bound for an O(log C + log R) start. Behaviour-preserving: lower_bound keeps the first-duplicate range start, and upper_bound keeps the last-duplicate / later-chunk-at-shared-boundary semantics of the previous reverse scans. Adds regression tests for duplicate timestamps, shared chunk boundaries, and single-point ranges. Makes the ARCHITECTURE.md "binary-searches" claim accurate. Internal optimization; no API/ABI change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
number_parse.{hpp,cpp} (pj_base, Apache-2.0) lacked their
SPDX-License-Identifier headers -- the dual-license boundary relies on
per-file headers, so add them. All four branch-triggered workflows still
keyed on the deleted `development` branch; restrict them to `main`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
b0195e2 to
52127e1
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.
Two independent, low-risk fixes surfaced during a code review, based directly on
main.1 · perf(datastore): binary-search
RangeCursorstart andlatestAtARCHITECTURE.mddocuments both as binary searches, butfindFirstValid()andlatestAt()linear-scanned the chunk deque and the rows within a chunk (O(C·R)). Committed chunks are never empty and are time-ordered (each chunk'st_min >= the previous chunk's t_max), sot_min/t_maxare monotonic across the deque and timestamps are monotonic within a chunk — enablingstd::lower_bound/std::upper_boundfor an O(log C + log R) start position.Behaviour-preserving:
lower_boundkeeps the first-duplicate range start;upper_boundkeeps the last-duplicate / later-chunk-at-shared-boundary semantics of the previous reverse scans. Adds regression tests for duplicate timestamps, shared chunk boundaries, and single-point ranges. Makes theARCHITECTURE.md"binary-searches" claim accurate.2 · chore: SPDX headers + drop stale
developmentCI triggernumber_parse.{hpp,cpp}(pj_base, Apache-2.0) were missing theirSPDX-License-Identifierheaders — the dual-license boundary depends on per-file headers, so add them. All four branch-triggered workflows still keyed on the deleteddevelopmentbranch; restrict them tomain.Verification
-Wall -Wextra -Werror+ ASAN (./build.sh --debug)../test.sh), incl. the new query edge tests andderived_engine_test/engine_integration_test, which exerciselatestAtthrough the MIMO join.Release
PATCH-level — an internal behaviour-preserving optimization plus SPDX/CI hygiene. No API/ABI change.
🤖 Generated with Claude Code