3

I understand async/await are really just promises but I'm curious if there's a reason not to make all functions async and await all value for consistency?

My Question

Is there any issues or implications to making all functions async? Are there any drawbacks?

This is for both Node.js and Client side systems (transpiled)

Jujunol
  • 457
  • 5
  • 18
  • 3
    Though asked for a different language, this question has some pointers: https://stackoverflow.com/questions/18498942/why-shouldnt-all-functions-be-async-by-default – Simon Brahan Nov 19 '19 at 11:30
  • 2
    check this answer https://stackoverflow.com/questions/46900782/what-is-the-overhead-of-javascript-async-functions – Louay Al-osh Nov 19 '19 at 11:39

1 Answers1

0

For many functions, you just want a result, and you want it now. Why would you go through all the extra overhead and complexity of async?

In other words, yes there are implications: there is almost certainly going to be a performance hit; partly because the code will be more complex.

MikeB
  • 580
  • 3
  • 18
  • since promises are part of the language and not a "on top" library or something similar, the runtime can decide to execute a promise immediately. there is not a performance hit in client computing rather than allowing your application to deliver steady 60 fps – GottZ Nov 19 '19 at 11:35