prometheus / prometheus/client_java
Extra allocations in `*TextFormatWriter` because of Java 8 target
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 2.3k
- Fork
- 833
- Merge medio
- 2g 16h
- PR unite (30g)
- 86
Descrizione
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?
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da OpenMetricsTextFormatWriter.java alla riga collegata e verifica come il progetto abbia come target Java 8. Quindi analizza le opzioni di pubblicazione degli artifact e di multi-release JAR descritte nell’issue. Il lavoro sarà completo quando sarà disponibile un approccio documentato e approvato dai maintainer per ridurre queste allocazioni nel codice TextFormatWriter interessato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- build-system, release
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Tranquilla
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 35/100