Hacker News new | ask | show | jobs
by thatwasunusual 1999 days ago
> It's still useful to determine a theoretical "worst case" that could occur due to usage of promises here.

I disagree. It's not useful if the benchmark is both unrealistic and only applies to theoretical cases. As said: no sane developer would ever do this kind of calculation "async."

The author of this benchmark could have spent the exact amount of time writing an article that benchmarkes towards realistic and practical situations, like reading/writing from/to disk, communicating with an API, a database etc.

You could argue that the benchmark is _only_ about the async/await/promise overhead, but that doesn't make sense either: everything you do in a script, application and what not is basically "overhead" at some point. For example, if you want to calculate the fibonacci out of 10 given numbers, just do it with a calculator and store the result in an array. Anything else is overhead. Actually, using an array is probably also overhead, depending on the situation at hand.

1 comments

The point of a microbenchmark is to determine how much a single aspect impacts the performance.

Yes, everything impacts performance. But if you're trying to optimise a hot code path, you want to try minimising the unnecessary overheads.