2 ms·
I just spotted something about the arrays and wonder how much of a difference it would make in practice / is that where the TypedArrays don't get the expected s
by viraptor 5y ago
I just spotted something about the arrays and wonder how much of a difference it would make in practice / is that where the TypedArrays don't get the expected speedup. The loops in computeDerivatives are mostly in this form:
for (i=0; i<...; i++) {
this.g[i][u]...
H[i][u][v]...
I expect JS can't realistically invert the access order when JIT-ing and this completely destroys the cache.
If this can be inverted to:
this.g[u][i]...
H[u][v][i]...
over a TypedArray, that would scan a continuous array instead. (maybe even extract the common `this.g[u]` and `H[u][v]` out of the loop explicitly)
The rust code may have the same potential since it's iterating `array[i*n+...]` and `array[i*n*n...]` in a few places.