I have a lot of points represented by an id and their position as lat long coordinates. Every 10 seconds, a point is able to move and its position is updated. There may be 100,000 points at most but this number can also vary through time.
I need to send all this data to a user when it connects to my server.
To achieve this, I put them in a typed array like so :
var data = new Float32Array(points.length * 3);
for (var i = 0; i < points.length;i++) {
data[i*3]=points[i].id;
data[i*3+1]=points[i].position.lat;
data[i*3+2]=points[i].position.long;
}
The thing is, doing this takes about 0.9 millisecond on my computer which isn't so bad but not quite satisfying. The surprising thing is that of course when lines 3,4 and 5 are commented out, the algorithm is a lot faster, but once one is not commented, it doesn't change a lot whether the two others are or not, the time will be very similar.
I would like to know if I am doing something wrong here or if there is a faster way to achieve what I want.
Thanks in advance,