Repository navigation
Releases
mojo-aio v0.1.1
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)
returnHighlights
- Packaging only: the gate no longer flakes on the quickstart check, and the conda recipe pins the Mojo minor.
Changes
Changed
recipe.yaml:mojo-compilerrun dependency pinned to the build's minor (<1.3.0a0).
Fixed
scripts/check.sh: the quickstart check captured output instead ofrun | grep -qunder pipefail (SIGPIPE flake;mojo-lib-auditpipe-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
- As in v0.1.0.
Upgrade / run
None: no API change.
Commits
build: recipe pins mojo-compiler to the build's minor1a0ca41fix: quickstart check captures output instead of piping into grep -qe5b23c9docs: CHANGELOG names no home path63c6020chore(license): fill Apache-2.0 copyright notice
mojo-aio v0.1.0
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)
returnHighlights
- 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 useready().- 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
8109105docs: README, design, perf, quickstart example checked by the gatef9aa5e9refactor: epoll_ctl methods take an immutable Loop5b18f8cfeat: host binding, ONESHOT, thread-safe ready(), resilient acceptcbd4f2ffeat: epoll event loop, timers and non-blocking TCP