cheatah
Programs so fast they purrrrrrrrrrrrr like a kitten.
🐱 Programs so fast they purrrrrrrrrrrrr like a kitten. 🐆
Say it "cheetah." Spelled cheatah on purpose, because it feels like cheating: you write Python-like code and it runs at C++ speed.
cheatah is Python for people who care about performance: you write .purr source, compile it with purrc (lexer → parser → codegen → C++ → .so), and run it on the headless cheatah host. This site documents the standard library.
New here? If you want to know why cheatah exists despite the world already having too many languages, read Why cheatah?. If you'd rather just start writing code, jump to Getting started.
How to read these docs 🐾
Every standard-library function carries a Doxygen/Javadoc comment with a consistent contract, so you always know what a call costs:
@param/@return— what goes in and comes out.@complexity— the runtime complexity (Big-O) of the call.@alloc— the function's heap behavior:none, or what it allocates (allocates the result,allocates a temporary, scratch buffers, …). Memory behavior is a first-class part of the contract — cheatah exists for memory safety.@test— a link to the unit test that exercises the function.
On @complexity: this is the algorithmic (Big-O) cost — how the work scales with input size. Wall-clock time is machine-dependent, and the constant factors can shift with the C runtime / standard library linked at run time. Treat Big-O as the contract; benchmark for absolute numbers.
Examples in the docs: function pages are gaining a consistent @par Example block with runnable code — every plot function page carries one today, and the same convention is arriving across the extensions.
The entire library is verified on every QA-gate run under AddressSanitizer (the asan preset) and Valgrind (security/run-valgrind.sh), with 100% line and function coverage of the stdlib.
See the Performance guide for how cheatah delivers hand-written-C++ speed — zero-cost generic abstractions, declarative SIMD, and automatic string-concatenation optimization — at the cost of compile time.
Modules 🐆
Module | What it gives you |
|---|---|
| Authenticated encryption — ChaCha20-Poly1305 and AES-GCM (hardware-accelerated), from scratch. |
| Always-available built-ins: |
| Civil date & time values and formatting. |
| Ed25519 public-key signatures (RFC 8032), from scratch — sign, verify, keygen. Backs cheatah's module-integrity check. |
| SHA-256/SHA-512 digests (hex and raw), HMAC, HKDF (RFC 5869), and Base64. |
|
|
| numpy-style linear algebra on |
| Scalar math (pure, allocation-free) + |
| Ownership for shared state — |
| N-dimensional arrays generic over the numeric element type (deduced from the literals), with broadcasting + declarative SIMD. |
| Environment, process, and filesystem ( |
| NIST P-256 ECDSA signatures, from scratch — used to verify server certificates in |
| From-scratch input parsers — |
| Pseudo-random numbers and selection (per-thread engine — draws never race). |
| From-scratch linear-time regular expressions (lazy DFA) — immune to ReDoS by construction. |
| A pure-cheatah HTTP client (the first |
| TCP sockets — a small BSD-socket wrapper (Python- |
| Mean, median, variance, standard deviation. |
| Text ops + Python's |
| Command-line arguments ( |
| Real OS threads — |
| Monotonic / wall clocks and sleeping. |
| A from-scratch TLS 1.3 client (no OpenSSL); owning |
| A from-scratch WebSocket (RFC 6455) |
| X25519 Diffie–Hellman key agreement (RFC 7748), from scratch. |
hashlib, ed25519, x25519, p256, and aead are the from-scratch crypto primitives the tls client is built on — no OpenSSL anywhere in the stack.
Browse the Files and Namespaces tabs above for the full per-function reference, or start from a module's header (e.g. math.hpp, linalg/routines.hpp).
🐆 Built for speed. Guarded for safety. 🐱
C++ API parsed with Doxygen; this site is rendered by cheatah's own documentation generator.