"timfox" wrote : It's a well known fact that direct bytebuffer allocation is
much slower than non direct byte buffers.
|
| If you think about it when you allocate a non direct byte buffer then it basically
just needs to dereference a pointer to some memory on the Java heap, which is very quick.
But for a direct buffer, it has to malloc real memory from the OS, and do a bunch of other
house keeping.
|
| So yes, if you're using direct byte buffers it pays to re-use them.
|
| You should speak to Trustin about this. I believe Netty uses non direct buffers for
exactly this reason.
I need a direct buffer on AIO, because of memory alignments and JNI invocations.
But there shouldn' t be a reason for that. If I called malloc/posix_mem_align (which
is the same as malloc, but aligned) and created the direct myself using the memory
position, and a JNI method, it would be way much faster (100x as my test showed).
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4214497#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...