Extra allocations in `*TextFormatWriter` because of Java 8 target
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- java
- Domain
- build-system, release
Research direction
Start with OpenMetricsTextFormatWriter.java at the linked line and review how the project targets Java 8. Then investigate the artifact-publishing and multi-release JAR options described in the issue. Done would be a documented, maintainer-approved approach for reducing these allocations across the relevant TextFormatWriter code.
Written by the indexing model from the issue text.
Description
See this line of code:
Because of the Java 8 target, the string concatenation gets compiled to something like new StringBuilder().append(name).append(suffix).toString(), which allocates the memory at least twice (for the buffer in the StringBuilder and for the resulting string).
If the code was compiled for at least Java 9, it would use StringConcatFactory, which in this case would allocate the memory only for the resulting string.
Would the maintainers consider publishing multiple artifacts for different Java targets, or using multi-release JARs for the purpose of this and similar optimizations?
- Dominant language
- Java
- Stars
- 2.3k
- Forks
- 833
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 86
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 prometheus/client_java
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
prometheus/client_java#2416 · 1 comment ·
-
Switch Micrometer compatibility workflow to upstream once typed-descriptor path becomes default Open
Difficulty 1/5 Under an hour Newbie friendliness 86/100
prometheus/client_java#2182 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
prometheus/client_java#2306 · 9 comments · 4 reactions ·
-
Difficulty 5/5 Over a week Newbie friendliness 32/100
prometheus/client_java#2084 · 3 comments ·
-
prometheus/client_java#1915 · 1 assignee ·
All issues in prometheus/client_java
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100