whitequark / whitequark/parser
Performance issues on large inputs
Nobody has claimed this yet.
- Dominant language
- Yacc
- Stars
- 1.6k
- Forks
- 205
- PR merge metrics
- No merged PRs in 30d
Description
Noticed that parsing time has a worse than linear dependency on the input size. To illustrate it, I've generated a few files including ruby hashes growing in size in constant steps.
Results:
Profiling shows that we're spending most of the time in lexer's advance function which in turn spends 2/3 of it's time in Buffer#slice which in turn calls String#encode function.
Unfortunately I have no good ideas on how to solve the performance issue. It looks like fixing it could bring substantial speedup to a number of projects including widely popular rubocop. WDYT?
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.
Research direction
Start by reproducing the reported scaling behavior with the generated Ruby-hash inputs and profiling the lexer's advance function. Inspect how Buffer#slice calls String#encode, then compare parsing time and profiles after any investigation. Done means establishing the source of the worse-than-linear behavior and identifying or implementing a measured improvement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- compilers, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100