getappmap / getappmap/appmap-java
Reduce allocations required to enter a hook
Nessuno ha ancora preso questa issue.
- Lingua principale
- Java
- Stelle
- 88
- Fork
- 17
- Merge medio
- 2g 2h
- PR unite (30g)
- 1
Descrizione
When a method is called, an "event template" is cloned and passed into the hook to be mutated. The template serves as cache for all the static properties (src path, defined class, method id, etc). It prevents us from needing to perform costly run-time reflection in nearly all cases.
This means we're cloning a new event from and event template for every hook called. We can drop these allocations by implementing a custom serializer that writes properties directly from the event template.
Not in scope for this issue, but worth keeping top of mind, is that we can cut Event allocations almost entirely by reusing events. We only need enough events to fill the buffer in the file stream. Once they're written, we can place them back in the pool to be picked up by another thread.
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 individuando il percorso dell’hook che clona un modello di evento e il serializzatore che scrive gli eventi. Segui come le proprietà statiche passano dal modello a ogni evento clonato. Il lavoro è completato quando il serializzatore personalizzato scrive tali proprietà direttamente dal modello ed evita le allocazioni dei cloni per hook; l’issue non fornisce alcun file specifico né alcun test da eseguire.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- java
- Ambito
- performance
- Tipo di issue
- Refactoring
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100