-
Notifications
You must be signed in to change notification settings - Fork 0
perf(hyperdim): optimize serialization via single memcpy #220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
d-o-hub
merged 5 commits into
main
from
perf/hyperdim-serialization-memcpy-16945076874945486734
May 13, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
fabee7b
perf(hyperdim): optimize serialization via single memcpy
google-labs-jules[bot] a282bc9
Merge branch 'main' into perf/hyperdim-serialization-memcpy-169450768…
d-o-hub bf1a672
perf(hyperdim): optimize serialization via single memcpy
google-labs-jules[bot] 62b2a2d
perf(hyperdim): optimize serialization and deduplicate agents
google-labs-jules[bot] 7751fd5
perf(hyperdim): optimize serialization via single memcpy
google-labs-jules[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| --- | ||
| name: iterative-refinement | ||
| description: "Test-fix-validate loops for complex changes: run tests, identify failures, fix, validate, repeat until green. Use for red-green-refactor cycles." | ||
| --- | ||
|
|
||
| # Iterative Refinement | ||
|
|
||
| Test-fix-validate loops for complex changes requiring multiple iterations. | ||
|
|
||
| ## When to Use | ||
|
|
||
| - Complex changes spanning multiple files | ||
| - Refactoring with test coverage | ||
| - New features requiring TDD approach | ||
| - Bug fixes needing verification | ||
|
|
||
| ## Do NOT Use | ||
|
|
||
| - Single-file simple changes | ||
| - Documentation-only updates | ||
| - Changes without existing test coverage | ||
|
|
||
| ## Process | ||
|
|
||
| ``` | ||
| ┌─────────────────────────────────────────────────┐ | ||
| │ RED: Run tests, identify failures │ | ||
| │ GREEN: Apply minimal fix to pass │ | ||
| │ REFACTOR: Optimize while keeping green │ | ||
| │ REPEAT until coverage passes and clean │ | ||
| └─────────────────────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| ## Loop Parameters | ||
|
|
||
| | Parameter | Default | Description | | ||
| |-----------|---------|-------------| | ||
| | `MAX_ITERATIONS` | 10 | Maximum refinement cycles | | ||
| | `COVERAGE_THRESHOLD` | 80% | Minimum coverage to accept | | ||
| | `BENCH_BASELINE` | main | Branch to compare benchmarks | | ||
|
|
||
| ## Step-by-Step Execution | ||
|
|
||
| ### Phase 1: RED - Identify Failures | ||
|
|
||
| ```bash | ||
| # Run full test suite | ||
| cargo test --all-features --quiet 2>&1 | tee test-output.txt | ||
|
|
||
| # Parse failures | ||
| grep -E "^test .* FAILED" test-output.txt | ||
|
|
||
| # For specific test debugging | ||
| cargo test --test <test_name> -- --nocapture | ||
| ``` | ||
|
|
||
| ### Phase 2: GREEN - Apply Fix | ||
|
|
||
| 1. Analyze failure output | ||
| 2. Identify root cause (not symptom) | ||
| 3. Apply minimal fix to make test pass | ||
| 4. Do NOT refactor yet | ||
|
|
||
| ```bash | ||
| # Quick validation | ||
| cargo check --message-format=short | ||
| cargo test --all-features --quiet | ||
| ``` | ||
|
|
||
| ### Phase 3: REFACTOR - Optimize | ||
|
|
||
| Once tests pass: | ||
| 1. Identify code smells | ||
| 2. Apply refactoring patterns | ||
| 3. Run tests after each change | ||
| 4. Verify no regression | ||
|
|
||
| ### Phase 4: VALIDATE | ||
|
|
||
| ```bash | ||
| # Full gate sequence | ||
| ./scripts/validate.sh | ||
|
|
||
| # Coverage check (if configured) | ||
| cargo tarpaulin --all-features --out Stdout | ||
|
|
||
| # Benchmark comparison | ||
| cargo bench --bench benchmark -- --baseline main | ||
| ``` | ||
|
|
||
| ## Failure Categories | ||
|
|
||
| | Category | Pattern | Approach | | ||
| |----------|---------|----------| | ||
| | **Logic error** | Assertion mismatch | Fix implementation logic | | ||
| | **Type error** | Compilation failure | Fix types, add conversions | | ||
| | **Timeout** | Test exceeds limit | Optimize algorithm | | ||
| | **Race condition** | Flaky test | Add synchronization | | ||
| | **Environment** | Missing dependency | Fix setup, add config | | ||
|
|
||
| ## Iteration Tracking | ||
|
|
||
| Track each iteration: | ||
|
|
||
| | Iteration | Phase | Action | Result | | ||
| |-----------|-------|--------|--------| | ||
| | 1 | RED | Run tests | 3 failures | | ||
| | 1 | GREEN | Fix imports | Passes | | ||
| | 2 | REFACTOR | Extract function | Passes | | ||
| | 3 | VALIDATE | Coverage check | 85% covered | | ||
|
|
||
| ## Exit Criteria | ||
|
|
||
| Stop when ALL conditions are met: | ||
| - [ ] All tests pass | ||
| - [ ] Coverage meets threshold | ||
| - [ ] No clippy warnings | ||
| - [ ] No performance regression (>10%) | ||
| - [ ] LOC gates satisfied | ||
|
|
||
| ## Example Workflow | ||
|
|
||
| ``` | ||
| User: "Refactor the reservoir module" | ||
|
|
||
| Agent: [Iterative Refinement activated] | ||
| Iteration 1: | ||
| RED: cargo test → 2 failures in reservoir | ||
| GREEN: Fix borrow checker issue | ||
| Result: Tests pass | ||
|
|
||
| Iteration 2: | ||
| REFACTOR: Extract metrics to separate file | ||
| RED: cargo test → 0 failures | ||
| Result: Still green | ||
|
|
||
| Iteration 3: | ||
| VALIDATE: ./scripts/validate.sh | ||
| Result: All gates pass, 92% coverage | ||
|
|
||
| Final: Refactoring complete after 3 iterations | ||
| ``` | ||
|
|
||
| ## Anti-Patterns to Avoid | ||
|
|
||
| - Writing tests to pass buggy code | ||
| - Skipping failing tests instead of fixing | ||
| - Large refactors without incremental commits | ||
| - Ignoring performance regressions | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.