Skip to content

Commit

Permalink
feat(readme): add comparison between profilers
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrgredowski committed Sep 19, 2024
1 parent 4fa4d67 commit 0a943b8
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/profiling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,25 @@ python -m pyinstrument src/profiling/primes.py
python -m cProfile -o _profile_data.profile.pstats src/profiling/primes.py
python -m snakeviz _profile_data.profile.pstats
```

## Comparison

`pyinstrument`:

- Sampling profiler
- Lower overhead
- Easier to use
- Built-in visualization
- Good for quick, high-level analysis
- May miss very short function calls

`cProfile` with `snakeviz`:

- Deterministic profiler
- Higher overhead
- More detailed information
- Separate visualization tool (snakeviz)
- Captures all function calls
- Better for in-depth analysis

Choose pyinstrument for quick, low-impact profiling, and cProfile with snakeviz for comprehensive, detailed analysis.

0 comments on commit 0a943b8

Please sign in to comment.