10 messages in net.java.dev.jna.usersRe: [jna-users] performance of derefe...
FromSent OnAttachments
James WayNov 6, 2007 8:00 am 
Timothy WallNov 13, 2007 1:00 pm 
Wayne MeissnerNov 13, 2007 3:48 pm 
Duncan McGregorNov 13, 2007 4:10 pm 
Timothy WallNov 14, 2007 5:34 am 
Timothy WallNov 14, 2007 5:58 am 
Timothy WallNov 14, 2007 11:23 am 
Duncan McGregorNov 14, 2007 12:49 pm 
Shawn EricksonNov 14, 2007 1:13 pm 
Wayne MeissnerNov 26, 2007 8:15 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] performance of dereferencing c pointers in javaActions...
From:Timothy Wall (twal@dev.java.net)
Date:Nov 13, 2007 1:00:40 pm
List:net.java.dev.jna.users

On Nov 6, 2007, at 11:00 AM, James Way wrote:

I'm using jna to pass a large array of data from a database to a fortran program. I implemented this by passing a Pointer to a java callback function from native code, and I was wandering how fast this was compared to jni, for instance. Also, is using pointer.setFloat() as fast as using a pointer.getDirectByteBuffer()?

I'd recommend profiling your scenario to see what performs better. Direct buffers have higher allocation/deallocation costs than com.sun.jna.Memory, and native code can access either faster than a java primitive array. Tweaking the memory from Java will probably depend on the specific circumstances, since both methods use a dedicated JNI call to do the write. Wayne Meissner did some profiling in this area, but I don't recall the results.