Skip to main content

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 rangeprange 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 rangeprange 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

superfastpy-26.7.4.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

superfastpy-26.7.4-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file superfastpy-26.7.4.tar.gz.

File metadata

  • Download URL: superfastpy-26.7.4.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

Hashes for superfastpy-26.7.4.tar.gz
Algorithm Hash digest
SHA256 b5342a8fc6d0f74cd76674495cecc13aeacc6158fa486f68272d20e395ee8816
MD5 b16951f21ca786c5ae8b307807e996a4
BLAKE2b-256 4483b60c2387ef3556218d58c60c2f36b4c1c351727dc3e7ca431015149c7d70

See more details on using hashes here.

File details

Details for the file superfastpy-26.7.4-py3-none-any.whl.

File metadata

  • Download URL: superfastpy-26.7.4-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for superfastpy-26.7.4-py3-none-any.whl
Algorithm Hash digest
SHA256 74238f86bb2b49c6fe046e984839c925c38ecf510837ddc18c42d60d8dfa03aa
MD5 edd4ac48f37d919cc678e36bf50b5adb
BLAKE2b-256 239416322f2f5b6754e1efbdc88362f12c00447dbc138e86b967a134c85b68ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page