How to execute doSomething synchronous function in parallel with async.js?
You cannot. async.js
is made for asynchronous tasks only, hence the name (see also this answer on synchronous behaviour). Also, JavaScript cannot execute code in parallel because of its evented, single-threaded paradigm; it can only "wait" in parallel for the next event.
If you really have problems with your synchronous execution, try splitting up the array in smaller chunks and defer them with timeouts for non-blocking behaviour (see JavaScript Performance Long Running Tasks, How to stop intense Javascript loop from freezing the browser, How to make non-blocking javascript code?, Best way to iterate over an array without blocking the UI), or consider WebWorkers for really heavy computations. You can use async.js to manage those, then.