Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Allow quokka to profile callbacks #315

Open
bugs181 opened this issue Jan 10, 2019 · 3 comments
Open

Feature request: Allow quokka to profile callbacks #315

bugs181 opened this issue Jan 10, 2019 · 3 comments

Comments

@bugs181
Copy link

bugs181 commented Jan 10, 2019

Issue description or question

As the title implies, I would like to profile async/callback code. This should be possible as seen in other tools of this nature.

Sample code

function someFn(cb) {
  setTimeout(function() { // ?.
    cb()
  }, 20 * 1000)
}

someFn(function() { // ?.

}) // ?.

Example output

quokka

Quokka.js Console Output

​​​​Quokka #1 (node: v11.0.0)​​​​

​​​​​0.719ms​​​​​ at ​​​someFn(function () { })​​​ ​quokka.js:7:0​

Code editor version

Visual Studio Code v1.30.1

OS name and version

OSX Mojave v10.14

@ArtemGovorov ArtemGovorov changed the title Feature request: Allow quokka to profile async code. Feature request: Allow quokka to profile callbacks Jan 10, 2019
@ArtemGovorov
Copy link
Member

A quick note - async/await code profiling is actually supported:

(async () => {
    await (new Promise(resolve => setTimeout(() => resolve({ }), 300)))//?.
})()

screen shot 2019-01-10 at 6 49 40 pm

Callbacks are tricky though, because we would need some more context from user to correctly understand when user wants to start/stop the timer.

For example, you may profile the code with callbacks with console.time:

screen shot 2019-01-10 at 7 07 17 pm

We could introduce a similar construct to start/stop the timer (and display the execution time inline). For example: //?.s to start the timer, and //?.e to stop it and print the time. Would something like this work for you?

This should be possible as seen in other tools of this nature.

Could you please share what tools are you referring to?

@bugs181
Copy link
Author

bugs181 commented Jan 10, 2019

Absolutely! That's a compromise I'm willing to work with. I believe your other product Wallaby combined with Mocha will give you runtime testing/profiling for code. I abuse a Mocha test in this way to provide that information.

wallaby
mocha

@bugs181
Copy link
Author

bugs181 commented Jul 4, 2019

Bump.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants