Every 50 milliseconds, I am receiving an update from a server and then I am updating the point data in my Mapbox GL JS like this:
map
.getSource('pointsSource')
.setData(pointsData);
The drama begins when I discover that my laptop goes in turbo mode and uses 200% of the CPU, whereas where I am not doing .setData()
(not updating the data but only displaying the map) it works using 25%.
At any given time, I am updating only 25 points. How can I improve performance considering that it is not related to the number of points but rather to the fact that I am calling .setData()
very fast? I think this way because I did experiments with 1 point or 10000 and the result is the same (200% CPU).