A pure-python based benchmarking package for Python 🤪
Project description
TrueBench
TrueBench 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 TrueBench via pip:
pip install truebench
🔧 Usage
Here's an example of how to use TrueBench to benchmark Python code:
from truebench import mt, mc, mm
# Define a sample function for testing
def sample_function(n):
return sum(range(n))
# Test the mt function (measure execution time)
time_taken = mt(sample_function, n=1000000)
print("Time taken:", time_taken)
# Test the mc function (measure CPU usage)
cpu_usage = mc(sample_function, n=1000000)
print("CPU usage:", cpu_usage)
# Test the mm function (measure memory 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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fastbench-0.1.2.tar.gz
.
File metadata
- Download URL: fastbench-0.1.2.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2839ae68e304bc08b8c695b521a9872f55c8700c22c75ae908071cd3e0af549 |
|
MD5 | 99d19d999053b8f9532265a938ef9325 |
|
BLAKE2b-256 | 5c4a3aecb7be554ec6159f35418879a6bb9cc184f7a230aa8fcdffa798e7be15 |
File details
Details for the file fastbench-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: fastbench-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Linux/6.5.0-1018-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a16b1edb7c93bcae2a105c049ba613b8058d38125df8c049001b1f0ef35c65c |
|
MD5 | b4148d867ca7244e1b0715c82ea5cc9a |
|
BLAKE2b-256 | f016cdfbe0f228b3b4b1e4aae30ce04ae9d5163da132db9895b824dd3a96a952 |