Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
NobisIndustries committed Jul 14, 2022
1 parent 9724a7a commit 81e80f1
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# python-profiling-helpers
A small python package for commonly used profiling tools.
# Profiling Helpers

A small python package that wraps Python's own `cProfile` library to make it more user friendly.


When developing Python programs, you'll sometimes have functions that take a long time to execute and
you are really not sure why. Profiling helps to find and analyze these bottlenecks and guides you
into fixing performance problems. Uses [snakeviz](https://jiffyclub.github.io/snakeviz/) for interactive visualizations.

Install it with `pip install profiling-helpers`.

There are two decorators, `time_it` and `profile_it`. Use them anywhere in your code, like this:

```python
from profiling_helpers import time_it, profile_it
from time import sleep

@time_it
def my_slow_function(x):
sleep(10)
return x

my_slow_function(42) # Prints: Function "my_slow_function" took 10.01061 s to run
```


```python
@profile_it("my/profile/save/dir", open_visualization=True)
def my_slow_function(x):
sleep(10)
return x

my_slow_function(42) # Opens snakeviz after this function is completed
```

0 comments on commit 81e80f1

Please # to comment.