I do not know about jQuery (if there is some kind of shell in jQuery), but in vanilla JS there is the concept of WebWorkers (support is pretty good, except for IE - see here ).
Here you run an additional thread for your calculations that does not block your user interface thread. When the calculations are done, and only the display of the results remains, you send the data from the worker to the user interface stream and simply show the results.
See the MDN tutorial for more information.
source share