FastBench
FastBench is a high-performance Python package for benchmarking code execution time, CPU usage, and memory usage. It's implemented in Python for simplicity and provides a simple API for measuring the performance of your Python code.
✨ Features
- ⏱️ Measure the execution time of a function or code block
- 📊 Track CPU usage during code execution
- 🖥️ Monitor memory usage during code execution
- ⚡ Lightweight and fast
- 🔄 Simple and easy-to-use API
Installation
You can install FastBench via pip:
pip install fastbench
Usage
Here's an example of how to use FastBench to benchmark Python code:
from fastbench import mt, mc, mm
def sample_function(n):
return sum(range(n))
time_taken = mt(sample_function, n=1000000)
print("Time taken:", time_taken)
cpu_usage = mc(sample_function, n=1000000)
print("CPU usage:", cpu_usage)
memory_usage = mm(sample_function, n=1000000)
print("Memory usage:", memory_usage)
Contributing
Contributions are welcome! Check out the Contribution Guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.