Skip to main content

FastPython ⚡

AOT Hardware-Adaptive Native Machine Code Compiler for Python

FastPython erkennt beim Start automatisch die Architektur und Fähigkeiten deiner Host-CPU (AVX2, AVX-512, FMA3, BMI2, Cache & Kerne), analysiert deine Python-Funktionen, übersetzt rechenintensive Schleifen und Algorithmen in optimierten C99/C++ Code und kompiliert diesen vor dem Start in hardwarenahen Maschinencode.

Beim wiederholten Starten sorgt ein intelligentes SHA-256 Caching dafür, dass keine Kompilierungszeit anfällt und das Modul in unter 1 Millisekunde direkt aus dem Cache geladen wird.


🚀 Benchmark-Ergebnisse (auf AMD Ryzen 7 5700X, 16 Threads, AVX2, FMA3)

Bereich / Algorithmus Standard CPython FastPython (Host AOT) Beschleunigung
Fraktale: Mandelbrot Multi-Core (250x250, 16 Threads) 662,7 ms 1,45 ms ⚡ 458,2x schneller
Stochastik: Monte Carlo Pi (3 Mio. Samples) 4.234,6 ms 13,7 ms ⚡ 308,6x schneller
Lineare Algebra: Vector Dot (1.000.000 Floats SIMD) 121,5 ms 0,73 ms ⚡ 167,4x schneller
Zahlentheorie: Collatz-Suche (50.000 Zahlen) 698,3 ms 7,2 ms ⚡ 96,8x schneller
Fraktale: Mandelbrot Single-Core (250x250, AVX2) 651,4 ms 8,58 ms ⚡ 75,9x schneller

🛠️ Verwendung

1. Zero-Touch Projekt-Beschleunigung (Empfohlen)

Füge einfach in deiner main.py als erste Zeile hinzu:

import fastpython.auto  # Aktiviert automatische Hardware-AOT-Kompilierung für das Projekt

# Ab hier: Importiere deine ganz normalen Projektdateien (ohne Decorator oder Änderungen!)
import simulation
import math_utils

# Alle Funktionen in diesen Dateien laufen jetzt im nativen Maschinencode!
simulation.run()

Führe dein Skript wie gewohnt mit Python aus:

python main.py

FastPython fängt alle Projekt-Imports ab, identifiziert rechenintensive Funktionen in allen Projektdateien, kompiliert sie vor der Ausführung in AVX2-Maschinencode und sichert sie im Cache. Bei jedem weiteren Start startet das Programm ohne Verzögerung sofort im nativen Modus.


2. Als gezielter Decorator für einzelne Funktionen

from fastpython import compile_native

@compile_native(fastmath=True, parallel=True)
def calculate_pi(n: int) -> float:
    acc = 0.0
    sign = 1.0
    for i in range(n):
        denom = 2.0 * float(i) + 1.0
        acc += sign / denom
        sign = -sign
    return 4.0 * acc

print(calculate_pi(20_000_000))  # 20 Millionen Iterationen in ~25ms!

3. Über das Command Line Interface (CLI)

# Host-Hardware analysieren
python -m fastpython info

# Benchmark-Suite ausführen
python -m fastpython benchmark

# Eigenes Skript mit FastPython starten
python -m fastpython run dein_skript.py

# Cache leeren
python -m fastpython clear-cache

⚙️ Wie es unter der Haube funktioniert

  1. Hardware-Profiling (fastpython.hardware): Liest über Low-Level CPUID und System-APIs ab, welche Befehlssätze dein Prozessor unterstützt (z. B. AVX2, FMA3, NEON).
  2. AST-Transpiler (fastpython.codegen): Untersucht den Python Abstract Syntax Tree (AST), extrahiert numerische Datentypen (int64_t, double) und entfernt das Python-Objekt-Boxing in inneren Schleifen.
  3. Host-Compiler (fastpython.compiler): Generiert die native C-Erweiterung und ruft den lokalen Compiler (MSVC BuildTools / Clang / GCC) mit maximalen Hardware-Flags (/arch:AVX2 /fp:fast /O2 /Oi /Ot) auf.
  4. Caching-Layer: Hasht Quellcode + CPU-Fingerprint + Compiler-Flags. Bei erneutem Start wird der kompilierte Maschinencode (.pyd / .so) sofort eingebunden.

Metadata

Release files for fastpython-native 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fastpython-native 0.1.0
File Size Uploaded Provenance
fastpython_native-0.1.0.tar.gz 21.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fastpython-native 0.1.0
File Interpreter ABI Platform
fastpython_native-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.9 kB

Release files / fastpython_native-0.1.0.tar.gz

Download URL fastpython_native-0.1.0.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
0548e82e030ada963cbef78703cc0b86e7e9e1ea09d483cfbab7d351f11c8b1e
BLAKE2b-256 checksum
How to use checksums
2e6d43bfd67132a4c47b1f7319768f4642c3fbbf20c82b1131d296437bf14880
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / fastpython_native-0.1.0-py3-none-any.whl

Download URL fastpython_native-0.1.0-py3-none-any.whl
Size 22.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57d4a87adaf50258c5060ba894e89bad311a3e678b41c8b94041b4b56991d413
BLAKE2b-256 checksum
How to use checksums
e3eefbe0c97c161ee3faf5450d058bb785550bca22d38c68c6da8a183ae6ab23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for fastpython-native 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page