Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

167
Views
Requiring complete module vs requiring only required functions in NodeJS

Is there any performance difference when I require complete module vs when I require only the specific functions from the module in NodeJS?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

First off, let's assume you're talking about the difference between this:

 const myModule = require('myModule');
 myModule.doSomething();

and this:

 const { doSomething } = require('myModule');
 doSomething();

In both cases, you're loading and initializing the entire module. In the second case, you're only retaining one exported function, but the entire module has still been loaded and is in the module cache.

Is there any performance difference when I require complete module vs when I require only the specific functions from the module in NodeJS?

No difference.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!