I'm developing an android app, in which I need to initialize float array. I have this code:
private float[] verticesArray;
private int vertexPosition = 0;
public void addVertexAttribute(float attribute) {
verticesArray[vertexPosition++] = attribute;
}
And when I run this code on my test devices - I got strange results: calling addVertexAttribute
30 times on Nexus 6P took 75000 nanoseconds, on HTC one x - 15000 nanoseconds, HTC desire C - 70000 nanoseconds. So, why is it 5x times slower on the most powerful device?
My Nexus 6P is on nougat 7.1.1, rooted. HTC One X is 4.1.1, rooted. HTC Desire C - 4.0.1, not-rooted.
Also, I'm using libgdx framework and this is a mesh initialization.
It's because Nexus 6+ devices has data encryption.