prometheus / prometheus/client_java
Extra allocations in `*TextFormatWriter` because of Java 8 target
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Java
- Sterne
- 2.3k
- Forks
- 833
- Ø Merge
- 2 T. 16 Std.
- Gemergte PRs (30 T.)
- 86
Beschreibung
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?
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit OpenMetricsTextFormatWriter.java an der verlinkten Zeile und prüfe, wie das Projekt auf Java 8 ausgerichtet ist. Untersuche anschließend die im Issue beschriebenen Optionen für die Veröffentlichung von Artefakten und Multi-Release-JARs. Als erledigt gilt ein dokumentierter, von den Maintainer genehmigter Ansatz zur Reduzierung dieser Allokationen im relevanten TextFormatWriter-Code.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- java
- Bereich
- build-system, release
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Ruhig
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 35/100