Closed wong2 closed 5 years ago
(async () => { const { start, job } = require("microjob"); try { // start worker pool await start(); // this function will be executed in another thread const res = await job(async () => { const module = require('some-module') return module.someFunction() }); console.log(res); } catch (err) { console.error(err); } })();
I'd like to know will the require in the job make the performance really bad?
require
It dependes but generally no. require is a kind of readFileSync operation so it takes the time of reading a file synchronously.
readFileSync
I'm closing this. Feel free to reopen it if you need more details about it.
I'd like to know will the
require
in the job make the performance really bad?