3 ms·
Re-using buffers, and only falling back to normal allocations for large sizes is fairly normal in networking code. You see the same strategy used in code for re
by nitwit005 8y ago
Re-using buffers, and only falling back to normal allocations for large sizes is fairly normal in networking code. You see the same strategy used in code for reading things like HTTP requests, in just about every language.
For example, Googling "Jetty buffer reuse" immediately popped up their ByteBufferPool class: https://www.eclipse.org/jetty/javadoc/9.4.8.v20171121/org/eclipse/jetty/io/ByteBufferPool.html https://www.eclipse.org/jetty/javadoc/9.4.8.v20171121/org/ec...