3 ms·
IMO writing synchronous code in Javascript seems like the premature optimization (e.g. fear of introducing cognitive overhead of async code?) when async code is
by always_good 8y ago
IMO writing synchronous code in Javascript seems like the premature optimization (e.g. fear of introducing cognitive overhead of async code?) when async code is so trivial to write and just about everything is already async.
Especially for something that is mostly filesystem access.
If this were Rust where you'd have to bring your own Tokio event loop or I/O thread pool because its filesystem API is blocking, then I'd probably agree.
For example, even though this example's `writePages` function writes each file serially, they would just change it into Promise.map(pages, writePage, { concurrency: 8 }) to add concurrent writes.