Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

143
Vistas
Does converting the synchronous function to an asynchronous function that does no asynchronous job under the hood bring about a performance loss?

That is if I want to rewrite a function that is given below

  getDefaultNodes(){
    return this.defaultNodes;
  }
engine.js
-----------------------------
  const defaultNodes = engine.getDefaultNodes();
the place where its method is called.

as

  async getDefaultNodes(){
    return this.defaultNodes;
  }
engine.js
-----------------------------
  const defaultNodes = await engine.getDefaultNodes();
the place where its method is called.

Does this cause a performance issue? If yes, to what extent?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Does this bring about a performance loss?

Yes. There's some overhead in creating the promise, resolving it, waiting for it, breaking the code apart on the await, and scheduling continuations on the microtask queue. It also will prevent some possible optimisations (or at least make them much harder).

If yes, to what extent? Is it an issue?

It depends. Measure it if you care. It might not be significant, but still I'd argue that at least it is bad code.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda