$ show awslabs/llrt
LLRT is a low-latency JavaScript runtime built in Rust around the QuickJS engine, designed primarily for AWS Lambda serverless workloads. The actual code confirms it is both a CLI runtime and a Lambda custom runtime: the `llrt` binary enters Lambda mode when `AWS_LAMBDA_RUNTIME_API` is present, and `runtime_client.rs` implements the full invoke/handler/response loop. It also provides `llrt compile` to emit QuickJS bytecode and self-contained executables, and `llrt test` to run a built-in Jest-compatible test runner. The runtime reimplements a broad surface of Node.js and Web APIs in Rust: `fs`, `net`, `http`, `crypto`/WebCrypto, `fetch`, `stream`/Web Streams, `events`, `timers`, `buffer`, `url`, `os`, `path`, `temporal`, `zlib`, `child_process`, `dgram`, and `intl`.
The LLM identified 5 files worth highlighting for reuse:
Implements JSON string escaping using SIMD-within-a-register (SWAR) techniques to scan 64 bytes at a time, with chunking logic that handles expansion ratios from 0.25x to 6x. It is an isolated utility with no LLRT-specific coupling, and the pattern is directly reusable in any JSON serializer or text processing hot path.
Caches JavaScript built-in constructors and functions at runtime initialization so modules can access them quickly and avoid relying on mutable global lookups. This protects against prototype pollution and performance regressions, and the pattern applies to any rquickjs/QuickJS host embedding.
Provides an async byte queue with semaphore/notify coordination, enabling backpressure between producers and consumers without busy waiting. The component is self-contained and reusable for streaming I/O, pipeline stages, or any bounded byte transfer between async tasks.
Defines a `CryptoProvider` trait and routes WebCrypto operations to feature-gated backends: pure Rust, OpenSSL, ring, and graviola. The abstraction cleanly separates algorithm support, key import/export, and hybrid provider composition, making it a strong reference for designing multi-backend cryptographic libraries.
Implements parsing and verification of Subresource Integrity hashes per the W3C SRI specification, including multiple hash algorithms and strict base64 handling. It is a modular security primitive that can be lifted into fetch clients, CDNs, or package integrity checkers with minimal modification.