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

refactor[codegen]: add profiling utils #4412

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

charles-cooper
Copy link
Member

add two new profiling utils, profileit() and cumtimeit() which run cProfile and printout cumulative time spent in a context, respectively.

the functions both return a context manager, so it can be used both in a with statement or as a function decorator, e.g.:

@profileit()
def foo():
    ...

@cumtimeit("foo")
def foo():
    ...

in a with statement

with profileit():
    foo()

with cumtimeit("foo"):
    foo()

neither of these should be used except for in local dev work, so they are ignored in coverage, and a warning is printed out if they are used as a reminder to remove them before pushing.

What I did

How I did it

How to verify it

Commit message

Commit message for the final, squashed PR. (Optional, but reviewers will appreciate it! Please see our commit message style guide for what we would ideally like to see in a commit message.)

Description for the changelog

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

add two new profiling utils, `profileit()` and `cumtimeit()` which run
cProfile and printout cumulative time spent in a context, respectively.

the functions both return a context manager, so it can be used both in a
with statement or as a function decorator, e.g.:
```python
@profileit()
def foo():
    ...

@cumtimeit("foo")
def foo():
    ...
```
in a with statement
```
with profileit():
    foo()

with cumtimeit("foo"):
    foo()
```

neither of these should be used except for in local dev work, so they
are ignored in coverage, and a warning is printed out if they are used
as a reminder to remove them before pushing.
@charles-cooper charles-cooper merged commit f6030fb into vyperlang:master Dec 19, 2024
156 checks passed
@charles-cooper charles-cooper deleted the refactor/profileit branch December 19, 2024 16:08
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

Successfully merging this pull request may close these issues.

2 participants