Map lag when doing long calculations

When doing large calculation that takes more than 40ms I get a map lag if I am moving the map while running the calculation.
In the sandcastle above I am just stalling the js thread (simulating a hard calculations) and it causes a visual map lag without any significant frame rate drop.
The ‘stallingDuration’ variable controls the calculation time. Currently set to 100ms to make it more noticeable
Do you have any suggestions to implement besides reducing the calculation time?

See the continuation of this conversation in Map lag when executing a large calculation · Issue #11265 · CesiumGS/cesium · GitHub.