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

190
Visualizações
Does importing all in JavaScript affect performance

I am working on a testing project with the following structure:

project  
│
└─── jrns
│   │   journeys_1.js
│   │   journeys_2.js
|   |   Journeys.js
│   
└─── Test Suites
    │   suite1.js
    │   suite2.js

Each journeys_x file contains some user journeys written as functions, and the whole purpose of the Journeys file is to act as a hub of all the journeys. Journeys.js looks something like this:

import {journey_1_1,
        journey_1_2} from './journeys_1';
export {journey_1_1,
        journey_1_2};

import {journey_2_1,
        journey_2_2} from './journeys_2';
export {journey_2_1,
        journey_2_2};

The purpose of creating that hub is to make importing easier in the test suites:

import * as jrns from '../jrns/Journeys';

jrns.journey_1_2();

My question is the following, does importing everything this way in the test suites files affect performance since not all journeys are actually utilized within every test suite file? Also, if in journeys_1.js for example I needed to access a journey stored in journey_2 for example, would accessing it through the same importing mechanism

import * as jrns from './Journeys';

jrns.journey_2_2();

affect performance?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Performance can have a number of dimensions, i.e. runtime performance, memory complexity, etc. For this sort of thing you might be able to benchmark it but it might only have meaningful impact at some scale. In this case, without knowing the number of imports, it's likely impossible to say that it will have a meaningful affect. Any additional import does cost some runtime or memory space, sure, but as to whether that matters is another question.

To get you to an answer on whether this matters, you could consider whether the project is at scale (some thousands of tests to be run), how frequently this test suite is run (on commit, on PR, etc), and whether it's run on local machines vs a cloud-based CI system. If your project is not at scale and may not be for a long time, or if it is infrequently run, or if it's run in a CI system, the minor difference in runtime performance probably does not have an observable/meaningful effect.

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