I think the Envelope is nearly a totally internal thing and could be pooled and recyclable, which will help reduce the system's gc pressure, it does help.
https://github.com/netty/netty/blob/4.1/common/src/main/java/io/netty/util/Recycler.java
another kind of attempt:
https://github.com/classgraph/classgraph/commit/42c94905349f4d41635eabe100552210570eeed2
Here's a direct link to the ClassGraph recycler... feel free to copy/paste the code if you want (I haven't made this into a separate library yet...)
@lukehutch thanks for the link, this would be a big change to the fundamental, so I will first try with some experiment with jmh benchmark so does gc when I have time :)
Good idea to benchmark first :-) The performance hotspots are often not where you think they are!
Most helpful comment
@lukehutch thanks for the link, this would be a big change to the fundamental, so I will first try with some experiment with jmh benchmark so does gc when I have time :)