[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: ByteBuffer.allocateDirect ridiculously slow
timfox
do-not-reply at jboss.com
Tue Mar 3 04:14:55 EST 2009
It's a well known factor 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.
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4214413#4214413
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4214413
More information about the jboss-dev-forums
mailing list