Metadata-Version: 2.4
Name: superfastpy
Version: 26.7.3
Summary: Zero-configuration Python function accelerator. Just add @fast.
Author: 최운교
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: numba
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# ⚡ 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

```bash
pip install superfastpy
```

---

## 🔥 Quick Start

```python
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
```python
@fast
def my_func(arr):
    ...

# Or with options
@fast(backend="numba", verbose=True)
def my_func(arr):
    ...
```

### `@fast.parallel` — Force parallel
```python
@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
```python
@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

```python
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
