Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Runtime benchmarks

These benchmarks measure generated SDK request latency in TypeScript (Node), Python, Rust and Go against the same small HTTP API. They include hand-written clients and another generator in each language. See the versioned results for measurements and remaining performance gaps.

What is measured

A local HTTP/1.1 server serves precomputed JSON over keep-alive connections. Clients make sequential calls to read one item, create one item, or list 10, 100 or 1,000 items. Each item is approximately 300 bytes. The server and client run on separate pinned CPUs. Calls include HTTP transport, decoding, validation where enabled, and identical checks of the returned IDs and list lengths. Client construction and warm-up are outside the timed region.

Each client/scenario runs in five independent processes, in a randomized, interleaved order with a recorded seed. Tables show the median of the five per-process medians, their minimum–maximum range, and the median of the five per-process p99s. The range is run-to-run variation, not a confidence interval. Small changes and overlapping ranges should not be treated as established wins.

ScenarioTimed calls per processWarm-up calls per process
Read one item5,0001,000
Create one item5,0001,000
List 105,0001,000
List 1002,000400
List 1,00030060

Every TypeScript scenario instead receives at least 10,000 warm-up calls to reach V8's optimized execution tier. Cold start is measured separately: median wall time of 30 fresh processes, from spawn through one successful read to exit, including imports and client construction. This is not just SDK initialization.

Compare equal work

Comparisons are restricted to the same language and work tier. A smaller latency is better. There is no combined score or cross-language ranking.

TierWork performedTungsten configuration
ValidatedHTTP, typed result, request checks and default response schema checksDefault response validation
TypedHTTP and typed result, without response schema checksResponse validation off in TypeScript, Rust and Go
UntypedHTTP and generic decoded JSONPython response validation off; lower bound only

TypeScript types are compile-time only: a JSON type assertion is the typed baseline. Python with validation off returns dictionaries, so it has no Tungsten entry in the typed tier. Untyped clients receive no competitive ratio. Python sync and async results use sequential calls; they do not measure async throughput under concurrency.

Within a language, clients share the transport library/version, 30-second timeout, connection reuse, optimized build settings and result assertions. No call retries or redirects in this workload. Default garbage collection stays enabled. Tungsten retains its normal argument checks, headers, response metadata, deadline handling and retry bookkeeping even when response validation is disabled.

Remaining differences

  • TypeScript uses global fetch for all clients. The validated hand-written client uses matching Zod checks; openapi-fetch and the typed hand-written client omit runtime argument validation.
  • Python uses httpx. The validated hand-written client uses matching strict Pydantic checks. openapi-python-client constructs attrs models and parses timestamps; the hand-written typed client uses slotted dataclasses and keeps timestamps as strings. Tungsten keeps timestamps as strings too.
  • Rust uses reqwest and a current-thread Tokio runtime. Progenitor parses timestamps into date-time objects while Tungsten keeps strings. Tungsten retains unknown fields and returns response metadata; the hand-written baseline returns its model directly. Progenitor 0.11.2 is used to match the reqwest 0.12 transport family. Its generator receives the same schema with only the OpenAPI version marker changed from 3.1.0 to 3.0.3.
  • Go uses net/http. oapi-codegen uses time.Time and float32 where Tungsten uses strings and float64. Its typed integer decoder rejects integral JSON floats that the validated clients accept. oapi-codegen 2.7.2 is used for Go 1.24 compatibility. Tungsten eagerly retains its ordered Raw response for API compatibility. A lazy representation is proposed for a future 0.2.0 API review; it is not part of this candidate.

Hand-written validated clients match checks for this schema, not every feature of a complete SDK. Invalid responses are absent: default warn-mode behavior and fail-fast behavior therefore do not diverge during measurement.

Limits

These are loopback, successful-request microbenchmarks for one schema. They do not predict Internet latency, concurrent throughput, streaming, memory use, error handling or all API schemas. No TLS handshake or remote service work is included. Cold-start process costs and steady-state request costs answer different questions. Version comparisons use the same client and scenario; third-party comparisons use the same work tier. Candidate builds are explicitly labelled and do not imply that a version has been released.

For the initial 0.1.2 comparison, the release tag contains a Rust runtime whose package version is 0.1.0. The candidate runtime package is 0.1.3. This is the only difference between the two benchmark Cargo lockfiles; third-party Rust dependency versions are unchanged. The shared lockfile hash consequently differs for every Rust client, including the control clients.