Improve performance of Bridj by catching JNI objects (StructObject, pointerToString)

21 views
Skip to first unread message

Daniel Korzekwa

unread,
Aug 10, 2017, 2:47:38 PM8/10/17
to NativeLibs4Java
I call a simple function over JNI, like distance (obj1, obj2) but I do it millions of times. I found that calling this function over JNI is fast and what takes time is initializing Bridj JNI objects, like StructObject, pointerToString that form both obj1 and obj2 function arguments.

For many executions of distance() function ob1 and obj2 are the same, so by caching them I gain a huge performance improvement. I just wonder whether such caching could be incorporated into a Bridj library?


Reply all
Reply to author
Forward
0 new messages