This is an example showing performance differences between Blocking Code, Async Programming and Web Workers.
Problem Statement : Calculate average of sum of given count of numbers.
(Using for loop to calculate)
Time Taken :
Average :
(Using recursion and setTimeout)
Time Taken :
Average :
(for loop logic moved to web worker)
Time Taken :
Average :
You can read more about web workers here