https://github.com/lightning-ai/litperf
Lightweight performance tracker for Python code - zero overhead when disabled.
https://github.com/lightning-ai/litperf
Last synced: 5 months ago
JSON representation
Lightweight performance tracker for Python code - zero overhead when disabled.
- Host: GitHub
- URL: https://github.com/lightning-ai/litperf
- Owner: Lightning-AI
- License: apache-2.0
- Created: 2025-07-26T12:47:10.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-07-26T13:11:02.000Z (6 months ago)
- Last Synced: 2025-07-26T19:25:29.451Z (6 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# LitPerf
Lightweight performance tracker for Python code - zero overhead when disabled.
# install
```bash
pip install git+https://github.com/Lightning-AI/litperf.git
```
# Example use
```python
from litperf import PerfTimer
timer = PerfTimer()
# Step 1
numbers = [i * i for i in range(50000)]
timer.mark("step1: count")
# Step 2
total = 0
for num in numbers:
total += num / 2
timer.mark("step2: sum_numbers")
timer.print_report()
```
The above generates the following report:
```text
==============================
Timing Report:
start → step1: count: 0.0031 seconds
step1: count → step2: sum_numbers: 0.0036 seconds
------------------------------
Total time: 0.0067 seconds
------------------------------
```