Zero-configuration Python function accelerator. Just add @fast.
Project description
⚡ superfastpy
Zero-configuration Python function accelerator.
Just add @fast — superfastpy analyzes your code and applies the best backend automatically.
No compilation. No configuration. No learning curve.
🚀 Installation
pip install superfastpy
🔥 Quick Start
from superfastpy import fast
@fast
def sum_squares(arr):
total = 0.0
for i in range(len(arr)):
total += arr[i] * arr[i]
return total
That's it. superfastpy automatically detects the loop and compiles it to machine code via Numba JIT.
🧠 How it works
superfastpy analyzes your function's AST (Abstract Syntax Tree) at decoration time and selects the best backend:
| Code Pattern | Backend | Description |
|---|---|---|
| Nested loops | numba_parallel |
Auto-converts range → prange for true parallelism |
| Simple loops | numba |
JIT-compiled to machine code |
| Array / math ops | numpy |
Vectorized execution |
| Everything else | native |
No overhead added |
🎯 Decorators
@fast — Auto mode
@fast
def my_func(arr):
...
# Or with options
@fast(backend="numba", verbose=True)
def my_func(arr):
...
@fast.parallel — Force parallel
@fast.parallel
def dot_product(a, b):
result = 0.0
for i in range(len(a)): # ← superfastpy auto-converts to prange
result += a[i] * b[i]
return result
superpy rewrites range → prange via AST transformation automatically. No manual changes needed.
@fast.cache — Accelerate + cache results
@fast.cache
def heavy_compute(arr):
total = 0.0
for i in range(len(arr)):
total += arr[i] * arr[i]
return total
heavy_compute(arr) # computed
heavy_compute(arr) # cache hit — instant return
🛠️ Utilities
from superfastpy import info, benchmark, cache_stats
info(my_func) # prints backend info
benchmark(my_func, arr) # measures average execution time
cache_stats(my_func) # prints cache hit rate
📊 Benchmark Results
sum_squares → numba 0.0008ms
matrix_sum → numba_parallel 0.0100ms (small array; parallel shines on large data)
parallel_dot → numba_parallel 0.0088ms
heavy_compute → numba+cache 0.0125ms (cache hit rate: 75%)
add → native 0.0002ms
📄 License
MIT License
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file superfastpy-26.7.3.tar.gz.
File metadata
- Download URL: superfastpy-26.7.3.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53d61a6ce2ea08dfc2e93308063a6700925f97220c8a89065a91cff8c36e5c39
|
|
| MD5 |
46fb284f1c94b8269dc97a729f4750eb
|
|
| BLAKE2b-256 |
0909e4efe1f39806d824016cb1b42101b0a7cbeed9326b522fa28bc058418ab2
|
File details
Details for the file superfastpy-26.7.3-py3-none-any.whl.
File metadata
- Download URL: superfastpy-26.7.3-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5aa273fdb256050588a3d8b732631d3f1ae86a1329639ac822056302db5ea83
|
|
| MD5 |
f9c8d04438fb372ba235b536d198f0eb
|
|
| BLAKE2b-256 |
963427a5ebcc59c705c1d395ad463ca2f0aaabd426df561b4d39efcbb44eb101
|