Skip to content

Releases

connect-zig v0.7.0

Choose a tag to compare

@c4milo c4milo released this 26 Nov 23:39

It builds on colibri v0.22.0, at 3ac8c7bc, and on stdx v0.4.0, at fdfbb709, the commit that
colibri pins, and Rotor at af06860.

Changed

  • Breaking. A TLS client takes the program's one stdx.crypto.Context, of its CPU features
    and a secure random source (colibri decision 175). Add stdx to your build.zig.zon at the
    commit and hash connect-zig pins, ask it for .target, .release and .crypto = true, and
    replace .cpu = cpu with .crypto = stdx.crypto.init(cpu_features, secure.random()), as
    examples/quickstart does (decision 34). tls.Cpu
    is gone.
  • Breaking. colibri.Server takes no .cpu. It makes its context of engine.cpu_features
    and the system's entropy, or takes yours in .crypto.
  • Breaking. A program that drives colibri's pool or engine itself passes no random source:
    start_tcp, start_quic and Engine.init draw from the context in tls.
  • examples/validate states a pattern for each tag, and the full-stack
    check's span rules state one for each attribute key, so its validation numbers include a
    regular expression.

Benchmarks since the previous tag

connect-zig's values against v0.6.0: 4 better and 10 worse by 5% or more, of 58. Each compares the value its chart draws.

Chart Value Previous This tag Change
call-vs-go-arm64 small, Connect unary call, speed in multiples of connect-go's 9.45 9.98 ▲ 6% better
call-vs-go medium, Connect unary call, speed in multiples of connect-go's 11.74 10.70 ▼ 9% worse
call-vs-go medium, gRPC unary call, speed in multiples of connect-go's 11.77 10.72 ▼ 9% worse
fullstack-arm64 connect-zig, spans a second over TLS 707,579 743,128 ▲ 5% better
fullstack-compression-arm64 gzip, spans a second as a share of uncompressed over TLS 113.00 107.00 ▼ 5% worse
fullstack-validate-arm64 connect-zig, spans a second over TLS 707,579 743,128 ▲ 5% better
fullstack-validate-arm64 connect-zig + protovalidate, spans a second over TLS 600,779 525,107 ▼ 13% worse
fullstack-validate connect-zig + protovalidate, spans a second over TLS 529,528 451,208 ▼ 15% worse
speed-vs-go-arm64 deep, JSON encode, speed in multiples of Go's 18.72 20.94 ▲ 12% better
speed-vs-go small, binary decode+walk, speed in multiples of Go's 6.87 6.51 ▼ 5% worse
speed-vs-go large, binary decode+walk, speed in multiples of Go's 4.72 4.43 ▼ 6% worse
speed-vs-go small, JSON encode, speed in multiples of Go's 11.09 10.48 ▼ 6% worse
speed-vs-go small, JSON decode+walk, speed in multiples of Go's 13.19 11.74 ▼ 11% worse
validate-vs-go-arm64 small invalid, speed in multiples of protovalidate-go's 64.39 59.30 ▼ 8% worse

These charts ran on another CPU model than v0.6.0's, so they compare nothing: fullstack-compression, validate-vs-go.

Every value
Chart Value Previous This tag Change
call-vs-go-arm64 small, Connect unary call, speed in multiples of connect-go's 9.45 9.98 ▲ 6% better
call-vs-go-arm64 medium, Connect unary call, speed in multiples of connect-go's 12.16 12.31 ≈ +1.2%
call-vs-go-arm64 small, gRPC unary call, speed in multiples of connect-go's 10.69 11.17 ≈ +4.5%
call-vs-go-arm64 medium, gRPC unary call, speed in multiples of connect-go's 12.23 12.56 ≈ +2.7%
call-vs-go small, Connect unary call, speed in multiples of connect-go's 8.43 8.17 ≈ -3.1%
call-vs-go medium, Connect unary call, speed in multiples of connect-go's 11.74 10.70 ▼ 9% worse
call-vs-go small, gRPC unary call, speed in multiples of connect-go's 9.10 8.75 ≈ -3.8%
call-vs-go medium, gRPC unary call, speed in multiples of connect-go's 11.77 10.72 ▼ 9% worse
fullstack-arm64 connect-zig, spans a second over TLS 707,579 743,128 ▲ 5% better
fullstack-compression-arm64 gzip, spans a second as a share of uncompressed over TLS 113.00 107.00 ▼ 5% worse
fullstack-compression-arm64 gzip, calls a second at peak as a share of uncompressed over TLS 117.89 118.74 ≈ +0.7%
fullstack-compression-arm64 zstd, spans a second as a share of uncompressed over TLS 115.00 110.00 ≈ -4.3%
fullstack-compression-arm64 zstd, calls a second at peak as a share of uncompressed over TLS 119.17 119.56 ≈ +0.3%
fullstack-compression-arm64 brotli, spans a second as a share of uncompressed over TLS 92.00 90.00 ≈ -2.2%
fullstack-compression-arm64 brotli, calls a second at peak as a share of uncompressed over TLS 105.45 104.65 ≈ -0.8%
fullstack-validate-arm64 connect-zig, spans a second over TLS 707,579 743,128 ▲ 5% better
fullstack-validate-arm64 connect-zig + protovalidate, spans a second over TLS 600,779 525,107 ▼ 13% worse
fullstack-validate connect-zig, spans a second over TLS 582,979 607,418 ≈ +4.2%
fullstack-validate connect-zig + protovalidate, spans a second over TLS 529,528 451,208 ▼ 15% worse
fullstack connect-zig, spans a second over TLS 582,979 607,418 ≈ +4.2%
speed-vs-go-arm64 small, binary encode, speed in multiples of Go's 10.29 10.34 ≈ +0.5%
speed-vs-go-arm64 medium, binary encode, speed in multiples of Go's 11.29 11.75 ≈ +4.1%
speed-vs-go-arm64 large, binary encode, speed in multiples of Go's 3.21 3.21 ≈ +0.0%
speed-vs-go-arm64 deep, binary encode, speed in multiples of Go's 3.38 3.42 ≈ +1.2%
speed-vs-go-arm64 small, binary decode+walk, speed in multiples of Go's 7.18 7.36 ≈ +2.5%
speed-vs-go-arm64 medium, binary decode+walk, speed in multiples of Go's 10.83 10.74 ≈ -0.8%
speed-vs-go-arm64 large, binary decode+walk, speed in multiples of Go's 5.43 5.41 ≈ -0.4%
speed-vs-go-arm64 deep, binary decode+walk, speed in multiples of Go's 6.63 6.59 ≈ -0.6%
speed-vs-go-arm64 small, JSON encode, speed in multiples of Go's 9.96 10.35 ≈ +3.9%
speed-vs-go-arm64 medium, JSON encode, speed in multiples of Go's 10.22 10.69 ≈ +4.6%
speed-vs-go-arm64 large, JSON encode, speed in multiples of Go's 7.64 7.91 ≈ +3.5%
speed-vs-go-arm64 deep, JSON encode, speed in multiples of Go's 18.72 20.94 ▲ 12% better
speed-vs-go-arm64 small, JSON decode+walk, speed in multiples of Go's 11.73 12.12 ≈ +3.3%
speed-vs-go-arm64 medium, JSON decode+walk, speed in multiples of Go's 14.74 14.97 ≈ +1.6%
speed-vs-go-arm64 large, JSON decode+walk, speed in multiples of Go's 11.83 11.92 ≈ +0.8%
speed-vs-go-arm64 deep, JSON decode+walk, speed in multiples of Go's 12.35 12.73 ≈ +3.1%
speed-vs-go small, binary encode, speed in multiples of Go's 10.49 10.05 ≈ -4.2%
speed-vs-go medium, binary encode, speed in multiples of Go's 11.24 11.12 ≈ -1.1%
speed-vs-go large, binary encode, speed in multiples of Go's 3.23 3.32 ≈ +2.8%
speed-vs-go deep, binary encode, speed in multiples of Go's 3.42 3.50 ≈ +2.3%
speed-vs-go small, binary decode+walk, speed in multiples of Go's 6.87 6.51 ▼ 5% worse
speed-vs-go medium, binary decode+walk, speed in multiples of Go's 10.53 10.07 ≈ -4.4%
speed-vs-go large, binary decode+walk, speed in multiples of Go's 4.72 4.43 ▼ 6% worse
speed-vs-go deep, binary decode+walk, speed in multiples of Go's 4.95 4.91 ≈ -0.8%
speed-vs-go small, JSON encode, speed in multiples of Go's 11.09 10.48 ▼ 6% worse
speed-vs-go medium, JSON encode, speed in multiples of Go's 9.25 9.40 ≈ +1.6%
speed-vs-go large, JSON encode, speed in multiples of Go's 8.27 8.15 ≈ -1.5%
speed-vs-go deep, JSON encode, speed in multiples of Go's 18.73 17.80 ≈ -5.0%
speed-vs-go small, JSON decode+walk, speed in multiples of Go's 13.19 11.74 ▼ 11% worse
speed-vs-go medium, JSON decode+walk, speed in multiples of Go's 14.98 14.57 ≈ -2.7%
speed-vs-go large, JSON decode+walk, speed in multiples of Go's 12.25 11.95 ≈ -2.4%
speed-vs-go deep, JSON decode+walk, speed in multiples of Go's 13.42 13.04 ≈ -2.8%
validate-vs-go-arm64 small valid, speed in multiples of protovalidate-go's 19.07 18.50 ≈ -3.0%
validate-vs-go-arm64 small invalid, speed in multiples of protovalidate-go's 64.39 59.30 ▼ 8% worse
validate-vs-go-arm64 medium valid, speed in multiples of protovalidate-go's 14.64 14.41 ≈ -1.6%
validate-vs-go-arm64 medium invalid, speed in multiples of protovalidate-go's 33.63 34.13 ≈ +1.5%
validate-vs-go-arm64 rules valid, speed in multiples of protovalidate-go's 62.56 64.93 ≈ +3.8%
validate-vs-go-arm64 rules invalid, speed in multiples of protovalidate-go's 68.85 66.31 ≈ -3.7%

connect-zig v0.6.0

Choose a tag to compare

@c4milo c4milo released this 26 Nov 17:10

It builds on colibri v0.21.0, at 2ab43623, and on stdx at 5de7d89f and Rotor at af06860, the
commits that colibri pins. stdx brings chapulin at f29c066a.

Changed

  • Breaking. connect-zig names chapulin no more. colibri takes chapulin through stdx, as
    stdx.crypto (colibri decision 174), and oidc checks signatures with stdx.crypto.jws. A
    program that names stdx beside connect-zig asks it for .target, .release and .crypto = true, or Zig builds a second stdx (decision 34). With .colibri = false,
    stdx fetches and links no chapulin, as before.

  • Breaking. A program no longer defines chapulin's assertion hook: chapulin's module
    defines ch_assert_fail itself (colibri decision 172), and stdx's root keeps it. Delete your export fn ch_assert_fail, or the link fails with a second definition. A program that reports a failed
    chapulin assertion its own way declares pub fn chapulinAssertFail(condition: [*:0]const u8, file: [*:0]const u8, line: c_int) noreturn in its root file.

  • Several servers on colibri.Server share one port over TLS, h3 included: each server's UDP
    socket now binds with SO_REUSEPORT, as its TCP listener does (colibri decision 173).

Benchmarks since the previous tag

The previous tag has no file of values, so nothing compares.

connect-zig v0.3.0

Choose a tag to compare

@c4milo c4milo released this 22 Nov 19:13

protovalidate, whose rules, CEL included, compile with the program; colibri v0.19.0, stdx v0.1.2 and regex from stdx at 44615ef; and four API changes. CHANGELOG.md holds what it changes.

connect-zig v0.2.0

Choose a tag to compare

@c4milo c4milo released this 17 Nov 17:01

It builds on colibri v0.18.1 and on stdx v0.1.2, with Zig 0.16.0. Two changes to the API are
marked below.

Added

  • brotli both ways. A program places connect.BrotliEncoder in Encoders.brotli, and a server
    or a client then writes br: stdx's encoder at level 1 with a 128 KiB window, in 519 KiB.
    Before, br was read and not written.

Changed

  • CI runs connectrpc's conformance suite v1.0.7, where it ran v1.0.4: the server passes its 3714
    cases, and the client its 10711.
  • JSON encode writes a message with no member, {}, in one stdx call: tree's JSON encode takes
    27% fewer instructions.
  • Changes the API. compression.compress and compression.choose take the encoders as
    *const Encoders, since Encoders holds three pointers now. A call passes &encoders.
  • connect-zig builds on colibri v0.18.1 and on stdx v0.1.2, the tag colibri pins. A program that
    names stdx itself pins that tag too, so it links one stdx.
  • A server reads a large request body in a time that grows with its length. On colibri v0.17.3
    the time grew with the square of the pieces the body arrived in.
  • Changes the API. rpc.failure_of takes the pool's response, *const client.Response, in
    place of its client.Result, so it reads the code of a reset stream.
  • A call whose stream the server reset ends with the code gRPC's table gives the reset, over h2
    and h3: CANCEL gives canceled, ENHANCE_YOUR_CALM resource_exhausted, INADEQUATE_SECURITY
    permission_denied, and each other code internal. Before, each reset gave unavailable.

Fixed

  • Over HTTP/1.1, a stream that answers before its request ends keeps its connection, and a
    response that ends its connection says Connection: close, so a client never sends its next
    request into a closed connection (colibri v0.17.3).
  • A request to a path with no route gets its 404, 405, 501 or 503 when the connection is busy,
    where over HTTP/2 it could read a reset with CANCEL (colibri v0.17.3).
  • A Connect GET writes its query in the protocol's order: connect, base64, compression,
    encoding, then message. connectrpc's conformance suite v1.0.7 checks it.

Checked

  • The routed call runs in tables of 16 and 256 routes, and the performance gate counts its
    instructions there too.
  • A full-stack check loads connect-zig's OTLP sink beside OpenTelemetry's Collector, Vector and
    Rotel, each on one core. In CI's run 172, connect-zig held 4.0 times the Collector's spans a
    second on x86-64 and 5.0 times on arm64, with p99 under 100 ms. It held 12.0 and 13.3 times
    Vector's over TLS, and 3.0 and 3.3 times Rotel's in cleartext.

Note, 2026-11-17: the ratios above come from run 172, whose climb used coarse steps, so each
could be off by up to half. CI's run 177 refined each climb. One core of connect-zig held 3.0 and
3.4 times the Collector's spans a second over TLS, on x86-64 and arm64, and 9.5 and 10.4 times
Vector's. In cleartext it held 2.9 and 3.5 times Rotel's. The README on main gives these
numbers.

connect-zig v0.1.0

Choose a tag to compare

@c4milo c4milo released this 15 Nov 19:45

The first release. It builds on colibri v0.17.0, and on the stdx (22f5139) and chapulin
(v0.8.0) commits colibri pins, with Zig 0.16.0.

Protocols

  • Connect, gRPC and gRPC-Web, on the server and the client, over h11, h2 and h3, in cleartext
    and over TLS.
  • Unary calls and every stream type. Bidirectional streams are full-duplex over h2 and h3, on the
    server through type handlers and on the client through rpc.ClientCall's Sender. Over h11
    both sides are half-duplex (decision 18).
  • Server and bidirectional streams of any length. A type handler declares next, and its route
    asks it for one message at a time while the response memory has room (decision 33).
  • Connect's unary GET for methods marked NO_SIDE_EFFECTS.
  • gzip and zstd both ways. brotli is read, not written, until stdx has an encoder.
  • Interceptors on the server and the client, typed error details, timeouts, headers and trailers.
    A client interceptor's hooks get the context the call's init takes, such as a pointer to the
    program's state (decision 44).
  • A handler takes the call's context, its request and its response, as connect-go splits them:
    rpc.Context, rpc.Request(T) or RequestStream(T), and rpc.Response(T) or
    ResponseStream(T). An interceptor takes rpc.AnyRequest and rpc.AnyResponse, with no
    message (decision 36).
  • Values for each call, of a struct the program names as the route table's .Values. An
    interceptor writes them, and each callback of the call reads them with ctx.values
    (decision 35).
  • Each method is a stream route of colibri v0.17.0's router, which reads a whole body in place
    (decision 45). A small routed Connect call takes 4,204 instructions on CI's judge
    (x86-64-v3), where colibri v0.16.3, which copied each call's state at each request, took
    34,682.
  • A method Connect does not serve gets 405 with an Allow header, as connect-go answers.

OpenID Connect

  • oidc, a module that checks an OpenID Connect bearer token with no I/O: a JWT signed with
    RS256, ES256 or EdDSA, then its issuer, its audience and its times (decision 34). The program
    passes the issuer's JWK Set and the time.
  • oidc checks signatures with chapulin, the TLS library colibri links, through one object:
    connect-zig's build asks for chapulin with colibri's own request.
  • oidc.Interceptor, a server interceptor that refuses a call with no valid token, and lets
    the paths a program excludes through. It writes the claims into the call's values.
    Claims.string, integer and holds read a program's own claims, such as email or
    roles.

Protobuf

  • A runtime with no allocator: decoding leaves strings, bytes and repeated fields pointing into
    the input, and a message is encoded straight into the body it goes out in.
  • decode_into reads each repeated field's elements, and each recursive field's message, into
    storage the caller owns, once. A program that reads every field takes it, and parses nothing
    twice. decode stores nothing (decision 37).
  • JSON decode checks the binary it transcodes once, as it writes it, and decodes it one level:
    tree's JSON decode takes 23% fewer instructions, deep 17% and large 14%. An array of a packed
    field transcodes to one packed record, as the encoder writes it: packed JSON decode takes 18%
    fewer instructions.
  • JSON encode opens a nested message's object with its member's name in one stdx call: deep's
    JSON encode takes 9% fewer instructions.
  • A repeated field's iterator gives a message in place: for a field of messages, next
    returns a pointer, and copies no message that decode_into stored or that a program set.
    The pointer holds until the next call. A number, a string or an enum still comes back by
    value.
  • A server reads each binary request's repeated fields into storage once, so a handler that
    reads them parses them once: each route holds storage_bytes, message_bytes by default, and
    0 keeps decode. A client passes storage in its connect.Scratch.
  • Every scalar type, optional, packed and unpacked repeated fields, maps with every key type,
    oneofs, enums, recursive messages, and unknown fields kept and written back.
  • proto2, proto3, and editions 2023 and 2024, with groups, closed enums and utf8_validation.
  • The proto3 JSON mapping, with every well-known type: Timestamp, Duration, FieldMask, the
    wrappers, Empty, Struct, Value, ListValue and Any.
  • base64 from stdx for bytes in JSON, error details, "-bin" values and unary GET messages. A
    value whose pad characters do not complete a quantum of four is refused (RFC 4648 §4).
  • protoc-gen-connect-zig, a protoc and buf plugin that writes one .pb.zig file for each
    .proto file. A field or an enum value named protobuf gains an underscore, since each
    generated type declares its descriptor under that name.

Runs on any event loop

  • The library does no I/O, holds no allocator and reads no clock. It builds on colibri's protocol
    modules alone and never names Rotor (decision 32).
  • The examples run on colibri.Server and colibri's in-memory links, and one serves ELIZA on
    colibri's engine over Zig's std.Io, with no Rotor at all.
  • The package exports colibri's server, client, http, tls and colibri modules, so a
    program builds on the colibri that connect_colibri uses. .rotor = true builds
    colibri.Server and colibri.Client on Rotor (decision 39).
  • Each example is a Zig project of its own, which you can copy: its own manifest, schema and
    generated code. zig build test runs its check, and zig build serve serves its service over
    TLS on h11, h2 and h3, for curl and buf curl. examples/quickstart holds the README's steps
    (decision 41).

Checked

  • connectrpc's conformance suite v1.0.4: the server passes 2714 of 2714 cases. The client runs
    8264 cases, and passes each but one timing case of the reference server, which may fail and
    is listed as flaky with its reason.
  • Google's protobuf conformance suite, of protobuf v37.0's first release candidate, in binary
    and in JSON: 5635 cases pass, and 107 fail, each listed with its reason. The suite found and
    fixed a tag longer than 5 bytes read, lowercase "t" and "z" read in a JSON timestamp, a
    field mask written that JSON could not carry back, URL-safe JSON bytes with pad bits refused,
    and a oneof's repeated Lazy member that silently replaced the first.
  • Clients in other languages call connect-zig's server: connect-go, grpc-go, connect-es on Node,
    grpcio, tonic and connect-rust, across every protobuf type. connect-zig's client calls their
    servers too.
  • Every protobuf type is compared with Go's runtime, and closed enums and unchecked strings with
    upb's.
  • The tests run 97.6% of the library's lines under kcov, on CI's run 136 (decision 43).
  • OpenTelemetry's Go SDK exports spans to examples/otlp, OTLP's trace receiver, over gRPC with
    gzip and TLS, and the check reads each span back as the SDK ended it (decision 40).
  • A performance gate on instruction counts, for the codec and for a routed unary call. A
    benchmark beside Go's protobuf runtime and connect-rust's Buffa, and a routed call beside
    connect-go and connect-rust, which CI publishes.
  • CI runs the tests on x86-64 Linux and on arm64 Linux.
  • A project that fetches connect-zig as a package follows the README: it generates its code
    with the plugin, and serves a method over TLS on h11, h2 and h3. It calls the method with
    connect-zig's client over h2 and h3, and with curl over h11. tools/package_check.sh runs it
    as a CI job of its own.
  • oidc verifies the RFCs' known answers for RS256, ES256 and EdDSA, and RS256 tokens that
    OpenSSL signs, and each of its checks was broken on purpose to prove a test catches it.

Known limits

  • A function handler writes its whole stream in one call, so the router's response memory
    bounds it (decision 12). A long stream takes a type handler with next.
  • A stream cannot wait for an event of the program once its request ended. colibri issue 130,
    which asks for it, is still open at v0.17.0.
  • Against Buffa, connect-rust's protobuf runtime, on CI's run 129. On x86-64, connect-zig is
    faster on all eight messages in binary decode and in JSON decode, and with every field read
    after a binary decode; on seven in JSON encode; and on five in binary encode. On arm64, it is
    faster on all eight in binary encode, in JSON decode, and with every field read after a binary
    decode; on seven in binary decode; and on six in JSON encode. A message of small nested
    objects takes its JSON encode about 2.3 times Buffa's time on x86-64, and 2.0 times on arm64.
    The ratios move with the runner's CPU, and CI publishes the tables with each run.
  • The library does not report a missing required field (decision 23).