Skip to content
This repository was archived by the owner on Nov 22, 2026. It is now read-only.

Releases

mojo-aio v0.1.1

Choose a tag to compare

@amarbarosys amarbarosys released this 08 Nov 23:10

mojo-aio v0.1.1

Released: 2026-11-08 · Commit: 1a0ca41 · Previous: v0.1.0

What it does

epoll event loop for Mojo: readiness events, one-shot timers, non-blocking TCP. Callback-free:
wait() fills a list you own with (token, events) and you dispatch, so there is no closure
storage and no allocation per event. 163 lines of code, libc only, Linux.

Same server CPU per request as uvloop, a third of Python asyncio's, half the memory of either
(echo ping-pong, docs/perf.md).

import aio


def main() raises:
    var lfd = aio.tcp_listen(0)  # 127.0.0.1, a free port
    var loop = aio.Loop()
    loop.add(lfd, aio.IN, 1)
    loop.after(10, 2)  # one TIMER event in 10 ms
    var evs = List[aio.Event]()
    while True:
        _ = loop.wait(evs)
        for ev in evs:
            if ev.events & aio.TIMER:
                print("timer", ev.token, "fired; port", aio.local_port(lfd) > 0)
                aio.close(lfd)
                return

Highlights

  • Packaging only: the gate no longer flakes on the quickstart check, and the conda recipe pins the Mojo minor.

Changes

Changed

  • recipe.yaml: mojo-compiler run dependency pinned to the build's minor (<1.3.0a0).

Fixed

  • scripts/check.sh: the quickstart check captured output instead of run | grep -q under pipefail (SIGPIPE flake; mojo-lib-audit pipe-grepq).

Verified

Check Result
scripts/check.sh on Mojo 1.2.0 (timers, 10k connections, fd leak, negative control, doc check) PASS all
mojo-lib-audit before the fix FAIL pipe-grepq:scripts/check.sh

Known limits

Upgrade / run

None: no API change.

Commits

  • build: recipe pins mojo-compiler to the build's minor
  • 1a0ca41 fix: quickstart check captures output instead of piping into grep -q
  • e5b23c9 docs: CHANGELOG names no home path
  • 63c6020 chore(license): fill Apache-2.0 copyright notice

mojo-aio v0.1.0

Choose a tag to compare

@amarbarosys amarbarosys released this 04 Nov 14:18

mojo-aio v0.1.0

Released: 2026-11-04 · Commit: 8109105 · Previous: first release

What it does

epoll event loop for Mojo: readiness events, one-shot timers, non-blocking TCP. Callback-free:
wait() fills a list you own with (token, events) and you dispatch, so there is no closure
storage and no allocation per event. 163 lines of code, libc only, Linux.

Same server CPU per request as uvloop, a third of Python asyncio's, half the memory of either
(echo ping-pong, docs/perf.md).

import aio


def main() raises:
    var lfd = aio.tcp_listen(0)  # 127.0.0.1, a free port
    var loop = aio.Loop()
    loop.add(lfd, aio.IN, 1)
    loop.after(10, 2)  # one TIMER event in 10 ms
    var evs = List[aio.Event]()
    while True:
        _ = loop.wait(evs)
        for ev in evs:
            if ev.events & aio.TIMER:
                print("timer", ev.token, "fired; port", aio.local_port(lfd) > 0)
                aio.close(lfd)
                return

Highlights

  • A Mojo network server with uvloop's CPU cost per request and half its memory.
  • Timers and sockets in one loop, no callbacks to store.
  • Multi-threaded servers: shared epoll set, ONESHOT, per-thread buffers (mojo-bento runs on it).

Changes

Added

  • Loop (add/modify/remove/after/wait/ready), tcp_listen, local_port, accept, read, write, close.

Verified

Check Result
scripts/check.sh timers 2000 timers in order, worst 1.2 ms late, wait(20) not early
scripts/check.sh echo 10,000 concurrent connections, 446 MB echoed byte for byte
scripts/check.sh fd leak 5 fds before, 5 after; a no-close mutant fails with 10005
scripts/check.sh negative control AIO_BREAK=1 server fails the client
scripts/check.sh doc README block == examples/quickstart.mojo, example runs; drift fails
scripts/bench.sh CPU 4.5 us/req (uvloop 4.5, asyncio 14.8), RSS 11 MB
mojo-bento scripts/ci.sh on aio PASS (b1 to b6)

Known limits

  • Linux x86-64 only (packed 12-byte epoll_event). IPv4 only.
  • wait() is single-threaded (timer heap); other threads use ready().
  • No io_uring; no TLS. CI workflow has not run on GitHub yet (repo not pushed).

Upgrade / run

mojo run -I path/to/mojo-aio/src app.mojo

Commits

  • 8109105 docs: README, design, perf, quickstart example checked by the gate
  • f9aa5e9 refactor: epoll_ctl methods take an immutable Loop
  • 5b18f8c feat: host binding, ONESHOT, thread-safe ready(), resilient accept
  • cbd4f2f feat: epoll event loop, timers and non-blocking TCP