4

I have a complex flow of async/await functions that I would like to optimise.

Using the built-in profiler of Chrome dev tools is practical when debugging synchronous workflows, but tracking micro-tasks triggers to resume promises is a difficult workflow and gives little overview.

Different ideas: I was thinking in the lines of exploiting babel-generated code to gather time spent in different stages of promise resolving, or perhaps using untranspiled code and overriding the global Promise object to gain performance insights.

How can I debug performance of async/await functions in an effective manner?

1 Answer 1

1

After not getting any responses here, I made my own solution. It's very rough, but working. I did this by overriding the global Promise object. This only works for babel-transpiled async functions since native async apparently didn't respect the overridden window.promise. Through stack inspection by using Error().stack (thanks to this question) I could determine who was creating that promise.

The result can be found here and you can use npm i promise-performance

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.