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

141
Views
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 answers
Answer question

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 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!