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

Profiling generator functions #7

Open
khoover opened this issue Feb 6, 2021 · 0 comments
Open

Profiling generator functions #7

khoover opened this issue Feb 6, 2021 · 0 comments

Comments

@khoover
Copy link

khoover commented Feb 6, 2021

A common way to implement operating systems is via generator functions cached to global. Right now, decorating the definition with @profile results in the generation creation being profiled, but it does not profile what we actually care about, which is the .next() (or .throw() or .return()) invocation runtimes.

I'm proposing an @profileGenerator decorator, which is meant to be applied to generator functions and will patch the .next, .return, and .throw methods on the returned generator object with profiling versions, and recording the runtimes as fnName, fnName#return, and fnName#throw, respectively.

I could whip up a PR for this in about a week or so.

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

No branches or pull requests

1 participant