Use ecow as the representation for short, immutable strings#211
Use ecow as the representation for short, immutable strings#211arcanis merged 8 commits intoyarnpkg:mainfrom
ecow as the representation for short, immutable strings#211Conversation
⏱️ Benchmark Results
📊 Raw benchmark dataBase times: 3.136s, 3.215s, 3.171s, 2.749s, 2.887s, 2.643s, 2.718s, 2.776s, 2.904s, 2.813s, 2.756s, 2.884s, 2.765s, 2.838s, 2.796s, 2.801s, 2.826s, 2.866s, 2.782s, 2.881s, 2.750s, 2.779s, 2.658s, 2.719s, 2.710s, 2.841s, 2.793s, 2.869s, 2.822s, 2.916s Head times: 3.038s, 2.725s, 2.689s, 2.647s, 2.562s, 2.689s, 2.578s, 2.746s, 2.593s, 2.647s, 2.715s, 2.705s, 2.673s, 2.683s, 2.654s, 2.662s, 2.725s, 2.679s, 2.551s, 2.678s, 2.731s, 2.745s, 2.635s, 2.723s, 2.579s, 2.584s, 2.732s, 2.556s, 2.661s, 2.658s Benchmark: |
a8c0327 to
2bb34fc
Compare
ecow as the representation for short, immutable strings
Greptile OverviewConfidence Score: 5/5
Important Files Changed
|
arcanis
left a comment
There was a problem hiding this comment.
Looks good, but shouldn't that rather be in zpm-utils ?
Additional Comments (2)
In Also appears in this same match block for the Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/zpm-semver/src/version.rs
Line: 155:169
Comment:
[P0] `match last_char` arm ordering makes `'9'`/`'z'` cases unreachable.
In `next_immediate_spec`, the arms `'0'..'9'` and `'a'..'z'` appear before the more specific `'9'` and `'z'` arms, so `'9'` and `'z'` will always match the earlier ranges and never execute the intended wrap behavior (e.g., `'9' -> 'a'`, `'z' -> "za"`). This changes version bump semantics for RC strings that end with `9` or `z`.
Also appears in this same match block for the `'a'..'z'` vs `'z'` ordering.
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/zpm-semver/src/version.rs
Line: 164:166
Comment:
[P1] Incrementing RC string uses `as u8` on `char`, which is incorrect for non-ASCII.
`all_but_last_str.push((last_char as u8 + 1) as char)` will not compile on stable Rust (`char` can’t be cast to `u8` directly), and even if adjusted it would be wrong for non-ASCII digits/letters. Given the function already constrains input to ASCII ranges, this should use `last_char as u8` only after converting via `as u32`/`u8::try_from`, or better operate on byte literals.
How can I resolve this? If you propose a fix, please make it concise. |
Done in the last revision. |
Extract a new crate that wraps
ecowusing the newtype pattern.