Repository navigation
feat(core): implement string interning for performance - #18
Merged
Merged
Conversation
robcohen
force-pushed
the
feature/string-interning
branch
from
January 10, 2026 17:29
1364f57 to
5c4864d
Compare
Introduce InternedStr type to reduce memory allocations and improve comparison performance for frequently used strings like account names and currency codes. Changes: - Add InternedStr wrapper around Arc<str> with full trait support - Update Amount, Cost, CostSpec to use InternedStr for currency - Update all directive types to use InternedStr for accounts/currencies - Update Inventory and Position to use InternedStr - Update parser to produce interned strings - Update all downstream crates (booking, query, validate, plugin, wasm) Performance improvements (measured via cargo bench): - Parser: 25-40% faster throughput - FIFO/LIFO reductions: 45-58% faster - Cost calculations: 35-47% faster - Book value calculations: 23-46% faster - Position additions: 16-31% faster 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
robcohen
force-pushed
the
feature/string-interning
branch
3 times, most recently
from
January 10, 2026 18:38
222ace6 to
f90591c
Compare
- Add --benches flag to skip library unit tests in bench mode - continue-on-error for base branch without benchmarks - Skip comparison if base benchmarks fail 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
robcohen
force-pushed
the
feature/string-interning
branch
from
January 10, 2026 19:05
f90591c to
7962870
Compare
Add `[lib] bench = false` to crates with criterion benchmarks. This prevents `cargo bench` from running lib unit tests in bench mode, which don't recognize criterion arguments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Use `-p <package> --bench <name>` for each benchmark to avoid running library tests and binary tests in bench mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
Benchmark ResultsComparing Legend
|
robcohen
added this pull request to the merge queue
Jan 10, 2026
robcohen
added a commit
that referenced
this pull request
Jan 14, 2026
feat(core): implement string interning for performance
robcohen
added a commit
that referenced
this pull request
Jan 14, 2026
feat(core): implement string interning for performance
robcohen
added a commit
that referenced
this pull request
Jun 20, 2026
- Resolve cli_commands_test.rs conflict: keep both the #11 broken-pipe test (from main) and the new #18 empty-extract test. - Count EXTRACTED transactions right after importer.extract() and bail only when that is zero — before duplicate filtering (--existing) or --balance augmentation, which could otherwise mask the cause (all duplicates, or a lone balance directive). - Base the "Extracted N transactions" count on Directive::Transaction values rather than directives.len(). - Use OsStr-safe .arg(file.path()) in the regression test. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This was referenced Nov 27, 2026
robcohen
added a commit
that referenced
this pull request
Nov 28, 2026
…uct rounds
booked_cost_number decided whether a sale takes the lot exact total with
Decimal checked_mul, which rounds a product past 28 digits and returns it
anyway. A whole sale of 19.25 VTI {94.94 # 3.83 USD} looked exact, was
weighed at the exact product of the rounded per-unit cost, and a residual
of exactly -0.005 against a 0.005 tolerance became a spurious E3001. The
comparison is exact now.
Exact total-cost weights are kept (compatibility #18 now covers costs);
the one-cent difference an elided gain on an exact half-cent tie can show
is documented and registered as the total-cost-half-cent deviation in the
semantic gate, whose manifest is ratcheted.
WASM cache v158. Maintainer decision on question 2 of #3071.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
robcohen
added a commit
that referenced
this pull request
Nov 28, 2026
…uct rounds
booked_cost_number decided whether a sale takes the lot exact total with
Decimal checked_mul, which rounds a product past 28 digits and returns it
anyway. A whole sale of 19.25 VTI {94.94 # 3.83 USD} looked exact, was
weighed at the exact product of the rounded per-unit cost, and a residual
of exactly -0.005 against a 0.005 tolerance became a spurious E3001. The
comparison is exact now.
Exact total-cost weights are kept (compatibility #18 now covers costs);
the one-cent difference an elided gain on an exact half-cent tie can show
is documented and registered as the total-cost-half-cent deviation in the
semantic gate, whose manifest is ratcheted.
WASM cache v158. Maintainer decision on question 2 of #3071.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
Introduce
InternedStrtype to reduce memory allocations and improve comparison performance for frequently used strings like account names and currency codes.Changes
InternedStrwrapper aroundArc<str>with full trait support (Serialize, Deserialize, Hash, Eq, Ord, Borrow)Amount,Cost,CostSpecto useInternedStrfor currencyInternedStrfor accounts/currenciesInventoryandPositionto useInternedStrPerformance Improvements (via cargo bench)
Migration
Code that constructs core types directly will need minor updates:
```rust
// Before
let amount = Amount::new(dec!(100), "USD".to_string());
// After - use .into() or pass &str directly
let amount = Amount::new(dec!(100), "USD");
```
Test plan
🤖 Generated with Claude Code