You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's always best to use critical access to primitive arrays using JNI ("GetPrimitiveArrayCritical") instead of using "GetArrayElements". The latter always makes a copy of the original array behind the scenes which is very bad for performance.
I'm aware of the copying (e.g. discussed here http://blog.mikiobraun.de/2008/10/matrices-jni-directbuffers-and-number.html), but thankfully, many matrix operations are slower than O(n), so the copying is negligible. In fact, this is one of the reasons why I do not call the native BLAS methods for low-level O(n) operations like addition.
When have the critical methods been introduced? Either I completely missed them or they have been added after 2008?
Happy to revisit, however, so again thanks for the pointer!
jblas/src/main/c/NativeBlas.c
Line 255 in acf3407
It's always best to use critical access to primitive arrays using JNI ("GetPrimitiveArrayCritical") instead of using "GetArrayElements". The latter always makes a copy of the original array behind the scenes which is very bad for performance.
Here's my lecture on critical access using JNI:
https://www.youtube.com/watch?v=PIaGaUeHlXU&list=PLWchVAowvRxCcofHJM62gI-CcRD14Apg9&index=4
Here are my full lectures:
https://www.youtube.com/playlist?list=PLWchVAowvRxCc4N5F5RTJnDV150Vf7ouf
Here's my science4j workspace:
https://github.com/javaNoviceProgrammer/science4j
The text was updated successfully, but these errors were encountered: