Optimize parse_in_bracket to avoid unnecessary String allocations
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Stale
- Tech stack
- rust
- Domain
- performance
Research direction
Start in parquet-variant/src/utils.rs at parse_in_bracket and inspect how VariantPathElement uses Cow. Compare bracket expressions with and without escape sequences, then verify that unescaped content is borrowed, escaped content still parses correctly, and the existing parquet-variant tests remain passing.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
I've noticed that parse_in_bracket in parquet-variant/src/utils.rs always allocates a String when parsing bracket expressions like [field] or [0], even when no escaping is needed:
fn parse_in_bracket(s: &str, i: usize) -> Result<(VariantPathElement<'_>, usize), ArrowError> {
let start = i + 1;
let mut unescaped = String::new(); // <-- Always allocates!
// ...
}
Describe the solution you'd like
I'm thinking of optimizing this by:
- Check if the content contains
\before allocating - Since
VariantPathElementalready supportsCow<'a, str>, we could borrow the slice directly when no escaping is present - Only allocate when we actually encounter escape sequences
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 1.3k
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 147
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/arrow-rs
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
development-process enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100