1) The algorithm is matrix multiplication. This is the same as what you learned in your class of linear algebra. (Source: http://androidxref.com/source/xref/frameworks/base/core/jni/android/opengl/util.cpp )
Does multiplyMM temporary partitions? It is native, so it does not matter. If there is a temporary variable, it is allocated on the stack. No GC, because it is native.
2) Maybe. Just because it is written in C ++, which does not speed up code execution. What for? There is overhead for moving from Java land to native code, and it is possible that the overhead outweighs the benefits derived from native code.
Despite all this, there are two more things to keep in mind: 1) Do not prematurely optimize your code if you are not sure that this is a performance bottleneck, and 2) if you are not sure, take some measurements. Profile your code to draw the right conclusions.
source share