perf(xlsx): hash-indexed style interning - #240
Open
eliahilse wants to merge 1 commit into
Open
Conversation
Contributor
|
All contributors have signed the CLA — thank you! ✍️ ✅ Posted by the CLA bot. |
Greptile SummaryThis PR replaces linear XLSX style interning with hash-indexed, live-pool-validated caches and makes custom number-format exhaustion explicit and atomic.
Confidence Score: 5/5The PR appears safe to merge; no concrete changed-code defect remains after checking cache mutation, allocation exhaustion, operation atomicity, undo behavior, and dependency changes. Cache hits are checked against live pools, custom-format allocation rejects exhausted or colliding IDs, production callers propagate that failure, and range operations commit only after complete staging succeeds.
|
| Filename | Overview |
|---|---|
| crates/xlsx-model/src/styles.rs | Adds validated style-pool caches, borrowed format resolution, and collision-safe fallible custom number-format allocation with extensive mutation and serialization tests. |
| crates/xlsx-ops/src/apply.rs | Propagates number-format exhaustion and stages complete range-format changes before committing styles, cells, and inverses. |
| crates/betteroffice-xlsx/src/authority.rs | Adapts collaborative style materialization to propagate the newly fallible style-interning result. |
| crates/xlsx-parse/src/tests.rs | Updates style-writing coverage for the fallible interning API while preserving existing package-fidelity assertions. |
| crates/xlsx-render/src/lib.rs | Updates rendering tests to unwrap the new fallible style-interning result. |
| crates/xlsx-model/Cargo.toml | Adds serde_json only as a development dependency for stylesheet serialization tests. |
| Cargo.lock | Records the xlsx-model serde_json development dependency without changing the flagged transitive dependency versions. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Range formatting operation] --> B[Clone stylesheet]
B --> C[Resolve each current cell format]
C --> D[Apply requested formatting]
D --> E[Intern through validated hash caches]
E --> F{Number-format ID available?}
F -->|No| G[Return NumFmtTableFull]
G --> H[Discard staged state]
F -->|Yes| I[Stage cell and style indices]
I --> J{All cells complete?}
J -->|No| C
J -->|Yes| K[Commit stylesheet]
K --> L[Commit cells and build inverse]
Reviews (1): Last reviewed commit: "perf(xlsx): hash-indexed style interning" | Re-trigger Greptile
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.
TL;DR:
Summary:
NumFmtTableFull) when ids are exhausted instead of silently collidingStylesheetgains private interning caches, which prevents exhaustive struct-literal construction downstream (changeset carries a minor bump)Test plan:
cargo test -p betteroffice-xlsx-model -p betteroffice-xlsx-opsgreen