TeamNewPipe / TeamNewPipe/NewPipeExtractor

High number of memory allocations when parsing timeago dates

Open
#1,037 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement performance YouTube
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:
image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.