Skip to content

refactor[codegen]: add profiling utils#4412

Merged
charles-cooper merged 1 commit intovyperlang:masterfrom
charles-cooper:refactor/profileit
Dec 19, 2024
Merged

refactor[codegen]: add profiling utils#4412
charles-cooper merged 1 commit intovyperlang:masterfrom
charles-cooper:refactor/profileit

Conversation

@charles-cooper
Copy link
Copy Markdown
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
@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