Batch Git note edits and add a Cargo benchmark example - #3004
Draft
Sebastian Thiel (Byron) wants to merge 2 commits into
Draft
Sebastian Thiel (Byron) wants to merge 2 commits into
Sebastian Thiel (Byron) wants to merge 2 commits into
Conversation
Creating many notes with repeated `State::replace()` calls serializes all materialized mappings after every edit. Add `State::edit()` to update retained state and `State::write()` to serialize once. Lookups observe pending edits, while immediate replacement and removal continue to flush. Failed writes recover the last saved root. Regression coverage checks zero writes during staging, cached reads, persisted replacements and removals, non-note preservation, no-op flushes, and recovery after failed writes. Validation with `GIX_TEST_IGNORE_ARCHIVES=1`: - `cargo test -p gix-note --all-features --locked --offline` (17 tests) - `cargo test -p gix --no-default-features --features sha1,notes --test gix --locked --offline repository::note::` (6 tests)
Register `gix-notes-bench` as a normal `gix` example gated by `notes` so Cargo example builds and Clippy cover it. It uses the staged notes API to create one note per commit-graph entry, packs the final objects, verifies them through a fresh object database, and only then creates an unused notes ref. Enable `gix-pack`'s `generate` and `streaming-input` features in a dev-dependency using the existing version and path. This supplies the features the standalone package previously got from `gix-pack` defaults without enabling them for normal library consumers. Validation: - `cargo check -p gix --examples --locked --offline` - `cargo clippy -p gix --no-default-features --features sha1,notes --example gix-notes-bench --locked --offline -- -D warnings` - `cargo run -p gix --no-default-features --features sha1,notes --example gix-notes-bench -- --help` - `cargo fmt --all -- --check` The normal library dependency graph with `sha1,notes` enables only `object-cache-dynamic,sha1` on `gix-pack`. The removed-Clippy-lint warning comes from existing workspace configuration.
| report("pack_and_index", pack_time, count); | ||
| report("write_total", create_time + pack_time, count); | ||
| println!("pack: {}", pack_path.display()); | ||
| println!("notes_commit: {notes_commit_id}"); |
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.
Tasks
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Summary
Bulk note creation previously serialized all materialized mappings after every edit. Add
gix_note::State::edit()to stage changes andState::write()to flush a batch once. Lookups see staged changes, existingreplace()/remove()calls still flush immediately, and failed writes recover the last successfully written tree.Add
gix-notes-benchas a normal Cargo example that creates one note per commit-graph entry, packs the final objects, and verifies every payload through a fresh object database before publishing an unused notes ref.Context
gix-noteAPI and regression coverage in one commit, followed by the benchmark integration in a second commit.notes. Enablegix-pack'sgenerateandstreaming-inputfeatures through a dev-dependency with the existing version and path, keeping those additions out of normal library builds.--all-targetscover the new example. No extra CI job is needed.Validation
All passed, reusing the cached build output and setting
GIX_TEST_IGNORE_ARCHIVES=1:cargo check -p gix --examples --locked --offlinecargo clippy -p gix --no-default-features --features sha1,notes --example gix-notes-bench --locked --offline -- -D warningscargo test -p gix-note --all-features --locked --offline— 17 testscargo test -p gix --no-default-features --features sha1,notes --test gix --locked --offline repository::note::— six testscargo run -p gix --no-default-features --features sha1,notes --example gix-notes-bench -- --helpcargo fmt --all -- --checkBoth test commands also passed with only the library commit applied. The final combined tree matches the validated tree. The normal dependency graph for
gixwithsha1,notesenables onlyobject-cache-dynamic,sha1ongix-pack. Existing removed-Clippy-lint and unused-test-helper warnings remain.Earlier validation reported in the handoff covered a 12,000-note comparison with Git and two complete 1,367,969-note round trips. Those larger workloads were not rerun for this Cargo integration.
User Prompts