I/O performance in Node.js worker threads
问题 Here's an example with worker thread that takes ~600ms on local machine for synchronous I/O: const fs = require('fs'); const { isMainThread, Worker, parentPort, workerData } = require('worker_threads'); const filename = './foo.txt'; if (isMainThread) { (async () => { console.time('!'); await new Promise((resolve, reject) => { const worker = new Worker(__filename, { workerData: filename }); worker.on('message', resolve); worker.on('error', reject); worker.on('exit', (code) => { if (code !== 0)