oxc-project / oxc-project/backlog
Build strings without repeated re-allocation and copies
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Same problem as #35, but difference is that once strings/Atoms are generated, they're immutable. So there's a simpler solution:
Assume we're going to create our own arena allocator.
Fill the allocator from both ends:
- Fill from end for AST nodes (bumping downwards, same as bumpalo does).
- Fill from start for strings (bumping upwards).
Same sort of idea as how heap grows upwards, and stack grows downwards.
We only build 1 string at a time, so can always grow strings in place while building them. This avoids memory fragmentation, and unused gaps in arena.
Side benefit: All string data in one place means AST transfer can convert all strings from UTF8 to UTF16 in one go (still complicated due to needing UTF16 indexes to slice that string, but it's a step in right direction).
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Read issue #35 first, then assess the proposed two-ended arena allocator: AST nodes grow downward and strings upward while one string is built at a time. Done means avoiding repeated string re-allocation and copies while supporting the stated UTF-8 to UTF-16 transfer goal.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100