I made recalculateFollowDistances async, it now processes in batches of 1000 and uses queueMicrotask
Discussion
Looks like that helped a lot. also I was calling the recalculate method every few seconds and it looks like thats not nessisary... so thats a x2 improvement right there :)
The only thing thats still causing the page to freeze is deserializing the graph. it takes about 3s on my machine
I haven't looked into it too much, but it looks like its the follow distance calculation that is taking the longest. do you think it would make sense to store the distance in the serialized graph in order to speed up load times?