Testing out how worker_threads performs against synced processing in a variaty of loads.
We looped over a massive quantity of numbers and squared them to simulate a difficult work job for the comupter
Synchronous processing seems to be faster becuase of the latency when communicating with the threads
Still worker threads is marginally slower.
This time, worker threads beats synced processing by a large margin
Once again, worker threads is significantly faster than single threaded. ~4 times faster, as expected, as we have 4 cores
This time worker_threads is not a clear winner, with just a 2 second lead on synced processing.
Worker_threads is ~13 times faster this time
Use worker_threads when you need massive computations to be done, otherwise the latency in communicating with the cores is too massive and will set you back.