TeamNewPipe / TeamNewPipe/NewPipeExtractor
High number of memory allocations when parsing timeago dates
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 2k
- Forks
- 602
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 6
Description
The cause is this line: https://github.com/TeamNewPipe/NewPipeExtractor/blob/5a9b6ed2e3306b9152cc6689dd61dbbe43483845/extractor/src/main/java/org/schabi/newpipe/extractor/localization/TimeAgoParser.java#L76
It looks like compiling a pattern makes a lot of memory allocations, and we should avoid it if possible.
Screenshot from profiler:

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
Start in extractor/src/main/java/org/schabi/newpipe/extractor/localization/TimeAgoParser.java at line 76, then inspect how timeago dates are parsed and how the pattern is compiled. Reproduce the profiler observation around that entry point and verify that parsing behavior is unchanged while the reported memory allocations decrease.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- performance
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100