Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

169
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda