Skip to main content

The library against Rust and Zig

Each module of std measured against the crates Rust's people use for the job and against Zig's own library, as the trials are (1553, 1629-1637): the time, the best of five runs after one to warm up; the most memory held; the size of the program stripped; and its lines. SG is built with --release and once more with its arithmetic checked, Zig with ReleaseFast and ReleaseSafe. The machine, the compilers and the flags are in How it is measured, and so are the rules of fairness (1554). python3 trials/measure.py std/json measures one module again.

Not measured yet: atomic, command_line, environment, files, path, process, regex, signals.

The trial grep measures Regex.isMatch already (Programs against Rust and Zig); regex gets a table of its own, with findAll, captures and replacing, in a later slice, as do atomic, files, process and signals, which 1637 does not name.

json​

trials/std/json: sum reads a document and walks it, counting the values of each kind and adding up the numbers; copy reads it and writes it back on one line; lines reads a document on each line and walks each. 100 MB of each kind from trials/inputs/json.sg, seed 1: records (numbers whole and not, texts with escapes and letters past ASCII, nested objects and arrays), one record a line, and polygons of coordinates of seventeen digits, as canada.json. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustZigZig, safe
Records, read and summed0.476 s, 786 MB0.494 s, 786 MB0.668 s, 1286 MB0.552 s, 1074 MB0.697 s, 1191 MB
Records, read and written back0.688 s, 881 MB0.722 s, 881 MB0.763 s, 1286 MB0.719 s, 1074 MB0.889 s, 1191 MB
A document a line, each read and summed0.392 s, 2.4 MB0.412 s, 2.4 MB0.543 s, 2.8 MB0.464 s, 2.2 MB0.582 s, 2.3 MB
Coordinates, read and summed0.355 s, 518 MB0.358 s, 518 MB0.415 s, 1117 MB0.457 s, 942 MB0.591 s, 1066 MB
Size, stripped99 KB99 KB485 KB426 KB522 KB
Lines130130111110110

Rust is serde_json 1.0.154 into a Value, with preserve_order and float_roundtrip (1638); without them the coordinates take 0.386 s and come out other numbers. Zig is std.json into a Value, in an arena (parseFromSliceLeaky), emptied before each line. The outputs are the same bytes; every number with a fraction in the inputs is written without an exponent and is not whole, since the three write 1e-7, 1e+16 and 2.0 each its own way. A struct mapped by #[derive(Deserialize)] reads faster in Rust, but does other work: SG has no mapping (1411). Before 1639 and 1640, SG took 0.590 s and 1,347 MB, 0.802 s and 1,443 MB, 0.438 s, and 0.467 s and 1,335 MB: the coordinates were the case it lost, at 1.13 times Rust. copy holds 95 MB more than sum: toJson makes the whole text before it is written, where Rust and Zig write as they go.

compression​

trials/std/compression, at level 6: compress reads 100 MB of the log of trials/inputs/text.sg and writes it in gzip into a file, a piece at a time; decompress opens the same, made by Python's gzip, on the standard output; records compresses each of 99,640 lines of trials/inputs/json.sg (about 370 bytes) in zlib and opens it again in memory; and the last case compresses 100 MB of trials/inputs/bytes.sg, which do not compress. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustRust, zlib-rsZigZig, safe
100 MB of a log, compressed1.616 s, 2.6 MB1.616 s, 2.6 MB1.675 s, 2.6 MB0.949 s, 2.7 MB1.556 s, 2.5 MB1.687 s, 2.7 MB
100 MB of a log, opened0.084 s, 2.7 MB0.124 s, 2.7 MB0.175 s, 2.3 MB0.086 s, 2.3 MB0.171 s, 2.3 MB0.206 s, 2.4 MB
99,640 records, each compressed and opened1.562 s, 2.6 MB1.765 s, 2.7 MB1.551 s, 2.6 MB1.694 s, 2.8 MB1.669 s, 2.4 MB2.020 s, 2.8 MB
100 MB that do not compress, compressed1.483 s, 2.6 MB1.592 s, 2.6 MB1.578 s, 2.5 MB1.267 s, 2.7 MB1.622 s, 2.5 MB2.020 s, 2.7 MB
Size, stripped115 KB132 KB435 KB483 KB394 KB474 KB
Lines868689899393

Rust is flate2 1.1.11, with its default miniz_oxide 0.9.1 and once more with the feature zlib-rs (0.6.8); Zig is std.compress.flate. What is compressed is not compared, since each finds its own matches: measure.py opens what each wrote and holds it to the input. The log took SG 18,728,988 bytes (zlib's own, byte for byte), miniz_oxide 18,371,889, zlib-rs 19,275,743 and Zig 19,229,859; the records 27,113,059, 27,110,665, 27,101,349 and 27,112,644; the bytes that do not compress 100,030,523, 100,015,773, 100,030,538 and 100,167,750. zlib-rs compresses at level 6 by zlib-ng's own way, which SG does not take (1485, 1651). Before 1646 to 1649, SG took 1.768 s, 0.169 s, 2.253 s and 1.490 s; before the CRC-32 and Adler-32 of the hundred-and-fifty-first slice (1656, 1658), 1.632 s, 0.108 s, 1.564 s and 1.511 s.

zip​

trials/std/zip: write cuts the same 100 MB of the log into 10,001 entries of 10,000 bytes and writes them deflated at level 6; read opens every entry of an archive of the same entries made by Python's zipfile into memory, its CRC-32 checked; list prints the name and the size of each of 100,000 small entries. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustZigZig, safe
100 MB in 10,001 entries, written1.068 s, 100.7 MB1.200 s, 100.9 MB0.770 s, 101.8 MB1.198 s, 98.7 MB1.322 s, 98.9 MB
10,001 entries, read0.139 s, 4.3 MB0.185 s, 4.3 MB0.183 s, 4.8 MB0.517 s, 2.2 MB0.586 s, 2.5 MB
100,000 entries, listed0.027 s, 19.6 MB0.027 s, 19.6 MB0.251 s, 22.7 MB0.008 s, 2.2 MB0.010 s, 2.5 MB
Size, stripped261 KB277 KB1678 KB394 KB490 KB
Lines616166159159

Rust is the zip crate 9.8.1 with its default features (it deflates with zlib-rs 0.6.8, and brings its other methods and encryption along, hence its size). Zig's std.zip reads archives and does not write them, so its write writes the headers of std.zip itself with std.compress.flate (1644), and its read checks the CRC-32 that std.zip does not (1645). The archives written took SG 25,831,364 bytes, Rust 25,934,270 and Zig 25,809,759, each read back by Python before anything was timed. SG checks every name of the archive against the others when it opens it (1503), which Rust and Zig do not; that is the time and the memory of the listing, which Zig does without keeping anything. Before 1650 and 1652, SG took 1.191 s, 0.231 s and 7.2 MB, and 0.048 s and 49.8 MB; before the CRC-32 of 1656, 1.086 s and 0.164 s.

hash​

trials/std/hash: sha256 hashes 100 MB of the log, read 64 KB at a time, as sha256sum does; chain hashes 32 zero bytes ten million times, each time the hash of the one before, the cost of one call with nothing read; hmac signs each of the 921,952 lines of the log with HMAC-SHA-256 under one key of 32 bytes and puts the tags together with XOR. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustZigZig, safe
100 MB of a log, hashed0.049 s, 2.0 MB0.048 s, 2.0 MB0.045 s, 2.0 MB0.041 s, 2.0 MB0.045 s, 2.2 MB
10,000,000 hashes, chained0.331 s, 1.8 MB0.334 s, 1.8 MB0.323 s, 2.0 MB0.284 s, 2.0 MB0.281 s, 2.1 MB
921,952 lines, each signed0.138 s, 1.9 MB0.138 s, 1.9 MB0.144 s, 2.1 MB0.113 s, 2.0 MB0.122 s, 2.2 MB
Size, stripped67 KB67 KB352 KB345 KB442 KB
Lines6767807676

Rust is sha2 0.11.1 and hmac 0.13.0 with their default features, Zig std.crypto.hash.sha2 and std.crypto.auth.hmac; all three use the SHA instructions of the processor, SG since 1657. A line is signed without its end, \n or \r\n, by each. Bytes.equalInConstantTime is not measured: alone it takes too little time to tell. Before 1657, SG took 0.303 s, 2.018 s and 1.001 s, six to nine times the others.

checksum​

trials/std/checksum: the CRC-32 and the Adler-32 of 100 MB of the log, read 64 KB at a time, and the CRC-32 of each of its 921,952 lines, put together with XOR. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustZigZig, safe
100 MB of a log, CRC-320.013 s, 2.0 MB0.012 s, 2.0 MB0.010 s, 2.1 MB0.219 s, 2.0 MB0.220 s, 2.2 MB
100 MB of a log, Adler-320.024 s, 2.0 MB0.046 s, 2.0 MB0.022 s, 2.1 MB0.034 s, 2.0 MB0.036 s, 2.1 MB
921,952 lines, each a CRC-320.044 s, 1.9 MB0.044 s, 1.9 MB0.035 s, 2.1 MB0.169 s, 2.0 MB0.170 s, 2.2 MB
Size, stripped83 KB83 KB352 KB345 KB442 KB
Lines5555586161

Rust is crc32fast 1.5.5 and adler2 2.0.1 (the Adler-32 of miniz_oxide) with their default features; crc32fast folds with the processor's carry-less product, as SG does since 1656. Zig's std.hash.Crc32 takes a byte at a time through one table. Reading 100 MB alone takes about 9 ms of each case. Before 1656 and 1658, SG took 0.035 s, 0.038 s and 0.060 s.

encoding​

trials/std/encoding: encode writes 100 MB of bytes that do not repeat (trials/inputs/bytes.sg) in Base64, read 48 KB at a time, and decode reads Python's Base64 of them back, 64 KB of text at a time, each into a file that must be what Python's base64 makes; hex writes ten million values of 32 bytes, the size of a SHA-256, as hex and reads each back, and tokens does the same with ten million tokens of 16 to 48 bytes in the Base64 of URLs, both from SplitMix64 and with no file read. Each program writes into buffers it keeps from one call to the next: SG through encodeInto and decodeInto (1665). Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustZigZig, safe
100 MB, written in Base640.069 s, 2.2 MB0.095 s, 2.2 MB0.050 s, 2.2 MB0.070 s, 2.1 MB0.072 s, 2.3 MB
133 MB of Base64, read back0.066 s, 2.2 MB0.093 s, 2.2 MB0.057 s, 2.2 MB0.053 s, 2.1 MB0.059 s, 2.3 MB
10,000,000 values of 32 bytes, in hex and back0.621 s, 1.9 MB0.733 s, 1.9 MB1.852 s, 2.0 MB0.402 s, 2.0 MB1.742 s, 2.1 MB
10,000,000 tokens, in Base64 for URLs and back0.605 s, 1.9 MB0.800 s, 1.9 MB0.443 s, 2.0 MB0.448 s, 2.0 MB0.510 s, 2.1 MB
Size, stripped67 KB83 KB369 KB361 KB474 KB
Lines169169137152152

Rust is base64 0.22.1 and hex 0.4.3 with their default features, through encode_slice, decode_slice, encode_to_slice and decode_to_slice; Zig std.base64 and std.fmt.bytesToHex and hexToBytes, whose hex of 32 bytes is an array of a size known when the program is compiled. SG reads its Base64 text checked to be UTF-8 first, as decode takes a string. Before 1664 and 1665 SG took 0.437 s, 0.635 s, 3.931 s and 4.531 s: a character written into a text at a time, each digit read through a row of comparisons, the bytes added to a list that grew, and a new text and list for each value. What is still slower is in Slower than C.

unicode​

trials/std/unicode: on each of the 950,206 lines of 100 MB of text in many writings (trials/inputs/unicode.sg: Turkish, French, German, Vietnamese, Greek with its old accents, Cyrillic, Korean, Japanese, Arabic, Devanagari, emoji and ASCII; 43% of the characters past ASCII), category counts the general category of each character; nfc writes each line of the text in NFD (made by Python's unicodedata, 121 MB) in NFC, and nfd each line of the text in NFD, each into a file that must be what Python makes; check asks of each line whether it is in NFC. Apple M3 Max, 21 November 2026:

CaseSGSG, checkedRustRust, unicode-normalizationZigZig, safe
100 MB, the category of each character0.464 s, 2.0 MB0.480 s, 2.0 MB0.491 s, 2.1 MB0.488 s, 2.1 MB0.499 s, 2.2 MB0.524 s, 2.3 MB
121 MB in NFD, each line into NFC0.755 s, 2.3 MB0.766 s, 2.3 MB0.932 s, 2.2 MB1.301 s, 2.3 MB1.008 s, 2.5 MB1.013 s, 2.6 MB
100 MB in NFC, each line into NFD0.650 s, 2.4 MB0.660 s, 2.4 MB0.657 s, 2.2 MB1.087 s, 2.2 MB0.753 s, 2.5 MB0.766 s, 2.6 MB
950,206 lines, each checked to be NFC0.308 s, 2.0 MB0.310 s, 2.0 MB0.428 s, 2.2 MB0.492 s, 2.1 MB0.378 s, 2.4 MB0.381 s, 2.6 MB
Size, stripped179 KB179 KB450 KB498 KB362 KB442 KB
Lines111111143143133133

Rust is ICU4X, icu_properties 2.4.0 and icu_normalizer 2.4.0, with their default features, writing into a text it keeps; built once more with the feature unicode-normalization, its normal forms are those of the crate unicode-normalization 0.1.26, the one most used, and its categories still ICU4X's. Zig's library has neither, so the Zig program calls ICU4C 79.1, as the trial of compression calls zlib where Zig has no compressor: its normal forms take UTF-16, and each line is turned into UTF-16 and back, which is part of what is measured. ICU4C 79 has the tables of Unicode 18.0, SG and Python those of 17.0; no character of the text is new in 18.0, and every build writes the same bytes. Nothing had to be made faster for this table.

time​

trials/std/time: format writes ten million moments between 1900 and 2200 in ISO 8601 into a text kept from one to the next, a quarter of them whole seconds and the rest with milliseconds, microseconds or nanoseconds; parse reads 100 MB of moments in RFC 3339 (trials/inputs/time.sg: offsets from -14:00 to +14:00 and Z, fractions of 0 to 9 digits) and takes each to UTC; local sees a million moments in the time zone of the system, TZ=Europe/Istanbul; clock reads the monotonic clock ten million times. The moments come from SplitMix64, and each program prints sums of what it wrote or read. Apple M3 Max, 22 November 2026:

CaseSGSG, checkedRustZigZig, safe
10,000,000 moments, written in ISO 86010.490 s, 1.8 MB0.597 s, 1.8 MB0.497 s, 5.4 MB0.700 s, 2.0 MB1.023 s, 2.1 MB
3,407,285 moments in RFC 3339, read0.136 s, 1.9 MB0.138 s, 1.9 MB0.173 s, 5.4 MB0.125 s, 2.0 MB0.127 s, 2.2 MB
1,000,000 moments, in the time zone0.203 s, 2.0 MB0.223 s, 2.0 MB0.054 s, 5.4 MB0.189 s, 2.2 MB0.193 s, 2.3 MB
The clock, read 10,000,000 times0.097 s, 1.8 MB0.099 s, 1.8 MB0.166 s, 5.3 MB0.158 s, 2.0 MB0.154 s, 2.1 MB
Size, stripped67 KB67 KB403 KB361 KB442 KB
Lines117117115235235

Rust is chrono 0.4.45 with its default features, writing with to_rfc3339_opts(SecondsFormat::AutoSi, true), four times as fast as write! with a format of % letters, reading with parse_from_rfc3339, and seeing the zone with with_timezone(&Local); its clock is std::time::Instant. Zig's library has no calendar before 1970, no ISO 8601 and no time zones: its program writes the calendar by hand (the days of Howard Hinnant), the text with std.fmt, reads RFC 3339 by hand, asks the C library's localtime_r for the zone, and reads std.Io.Clock.awake. Before choice 1673 SG wrote the moments in 1.183 s, each part of a date going through snprintf, and before 1674 read the clock in 0.178 s (CLOCK_MONOTONIC of macOS, where Rust and Zig read CLOCK_UPTIME_RAW). chrono sees a zone 3.8 times as fast, having read its TZif file once; SG asks localtime_r each time, as Zig does (Slower than C).

random​

trials/std/random: numbers draws a hundred million numbers of 64 bits from the seed 1, range a hundred million from 0 up to 1,000 into a histogram, fill 100 MB of bytes 64 KB at a time into one buffer, and tokens a million tokens of 64 hex digits from the random bytes of the system. Zig's generator is not SG's, so what is printed does not depend on the numbers drawn: whether the bits set, each bar of the histogram and the mean of every 64th byte lie within six standard deviations of what they should be, and whether every token is hex. Apple M3 Max, 22 November 2026:

CaseSGSG, checkedRustZigZig, safe
100,000,000 numbers of 64 bits0.100 s, 1.8 MB0.100 s, 1.8 MB0.100 s, 2.0 MB0.095 s, 2.0 MB0.272 s, 2.1 MB
100,000,000 numbers up to 1,0000.120 s, 1.9 MB0.111 s, 1.9 MB0.109 s, 2.0 MB0.101 s, 2.0 MB0.098 s, 2.1 MB
100 MB of bytes0.014 s, 2.0 MB0.014 s, 2.0 MB0.014 s, 2.0 MB0.015 s, 2.0 MB0.034 s, 2.1 MB
1,000,000 tokens of the system0.242 s, 1.9 MB0.243 s, 1.9 MB0.957 s, 2.0 MB0.051 s, 2.0 MB0.066 s, 2.1 MB
Size, stripped34 KB50 KB353 KB345 KB442 KB
Lines7878648686

Rust is rand 0.10.4 with rand_xoshiro 0.8.2's Xoshiro256StarStar::seed_from_u64, SG's own generator (xoshiro256** seeded with SplitMix64), whose numbers and bytes were held to be SG's on a million draws; its range is random_range, its tokens SysRng and hex::encode_to_slice. Zig is std.Random.DefaultPrng, xoshiro256++, a cheaper step than xoshiro256**, with uintLessThan and bytes, and its tokens Io.random, a ChaCha kept in the process and seeded by the system; SG asks the system for each token (arc4random_buf), as Rust's SysRng does (choice 1676). Before choice 1673 fill took 0.031 s, a byte at a time, and the tokens 0.341 s, a digit at a time.

log​

trials/std/log: lines writes a million lines at the level Info, request 12 took 84 ms; off makes a hundred million calls at the level Debug while the log writes from Info, none of which makes its text; tasks has four tasks write a quarter of a million lines each at once. Each line goes to the standard error, a file, as 2026-11-22T20:15:03.123Z INFO and the message, and measure.py holds every line to that form and the messages to be the same in every build. Apple M3 Max, 22 November 2026:

CaseSGSG, checkedRustZigZig, safe
1,000,000 lines1.864 s, 1.9 MB1.894 s, 1.9 MB1.851 s, 2.1 MB1.708 s, 2.0 MB1.805 s, 2.1 MB
100,000,000 lines that are off0.052 s, 1.8 MB0.083 s, 1.8 MB0.059 s, 2.1 MB0.042 s, 2.0 MB0.065 s, 2.1 MB
1,000,000 lines from four tasks2.761 s, 2.2 MB2.876 s, 2.2 MB3.642 s, 2.1 MB2.567 s, 2.1 MB2.615 s, 2.2 MB
Size, stripped68 KB84 KB473 KB361 KB458 KB
Lines4747509999

Rust is log 0.4.35 with env_logger 0.11.12, given SG's form of line, its time to the millisecond and no colour; Zig is std.log with a logFn that writes the same line under the lock of the standard error, the calendar by hand. Each line is one write of the system in all three, which is most of the time. Zig's level is fixed when the program is compiled, so its lines that are off are not in the program; SG reads its level, which SG_LOG may set, as the program runs. Before choice 1673 four tasks took 4.209 s on macOS, waiting in the kernel on the lock of C's stream.

net​

trials/std/net: each program is the server and its clients at once, tasks of one process over the loopback, each case once with async functions and once with functions that block, one task on a thread of its own (1678-1682). echo has 8 clients send messages of 64 bytes, 4 KB or 64 KB and wait for each to come back, 20,000 times each, and 1,000 clients do it at once 100 times; the server closes each connection once it has sent back all of it, so that the wait of TCP after a close lies on its side and the ports of the clients are free again (1684). connect makes 50,000 connections one after another, a byte there and back on each. stream sends 1 GB one way, 4 KB or 64 KB at a time. lines sends 100 MB of a log, which the other side reads line by line. udp has 8 sockets send 25,000 datagrams of 64 bytes, 1 KB or 8 KB each to one that sends each back. address reads ten million addresses with their ports, half of them v6 in four ways of writing, from a new maker, trials/inputs/address.sg, and writes each back into a text kept from one to the next; measure.py holds what each program writes of 1,000 of them to what Python's ipaddress writes. Apple M3 Max, 22 November 2026:

CaseSGSG, checkedRustZigZig safe
echo, 64 bytes, async1.208 s, 2.2 MB1.214 s, 2.2 MB1.196 s, 2.9 MB1.480 s, 2.9 MB1.470 s, 3.2 MB
echo, 64 bytes, blocking1.475 s, 2.2 MB1.477 s, 2.2 MB1.496 s, 2.5 MB1.488 s, 2.8 MB1.483 s, 3.0 MB
echo, 4 KB, async1.245 s, 2.3 MB1.247 s, 2.3 MB1.215 s, 3.0 MB1.512 s, 2.9 MB1.497 s, 3.2 MB
echo, 4 KB, blocking1.482 s, 2.3 MB1.485 s, 2.3 MB1.483 s, 2.6 MB1.479 s, 2.9 MB1.524 s, 3.2 MB
echo, 64 KB, async3.573 s, 3.7 MB3.570 s, 3.7 MB3.454 s, 4.4 MB3.589 s, 4.3 MB3.580 s, 4.8 MB
echo, 64 KB, blocking3.608 s, 3.7 MB3.614 s, 3.7 MB3.611 s, 4.0 MB3.597 s, 4.2 MB3.630 s, 4.8 MB
1,000 connections at once, async0.788 s, 3.8 MB0.788 s, 3.8 MB0.772 s, 3.8 MB0.945 s, 9.5 MB0.940 s, 12.3 MB
50,000 connections one after another, async4.460 s, 2.2 MB4.713 s, 2.2 MB4.838 s, 2.9 MB4.061 s, 2.1 MB4.044 s, 2.2 MB
50,000 connections one after another, blocking4.214 s, 2.1 MB4.150 s, 2.1 MB4.203 s, 2.1 MB4.169 s, 2.1 MB4.188 s, 2.2 MB
1 GB in pieces of 4 KB, async0.448 s, 2.1 MB0.447 s, 2.1 MB0.452 s, 2.9 MB0.416 s, 2.1 MB0.432 s, 2.2 MB
1 GB in pieces of 4 KB, blocking0.414 s, 2.0 MB0.417 s, 2.0 MB0.411 s, 2.1 MB0.429 s, 2.1 MB0.436 s, 2.2 MB
1 GB in pieces of 64 KB, async0.172 s, 2.2 MB0.174 s, 2.2 MB0.153 s, 3.0 MB0.172 s, 2.2 MB0.169 s, 2.3 MB
1 GB in pieces of 64 KB, blocking0.168 s, 2.1 MB0.170 s, 2.1 MB0.166 s, 2.3 MB0.172 s, 2.2 MB0.167 s, 2.3 MB
100 MB in lines, async0.050 s, 97.6 MB0.050 s, 97.6 MB0.067 s, 98.3 MB0.036 s, 97.6 MB0.037 s, 97.7 MB
100 MB in lines, blocking0.047 s, 97.4 MB0.047 s, 97.4 MB0.070 s, 97.6 MB0.035 s, 97.6 MB0.036 s, 97.7 MB
datagrams of 64 bytes, async1.687 s, 2.2 MB1.739 s, 2.2 MB1.674 s, 2.9 MB1.610 s, 2.5 MB1.627 s, 2.7 MB
datagrams of 64 bytes, blocking1.600 s, 2.0 MB1.574 s, 2.1 MB1.578 s, 2.3 MB1.598 s, 2.5 MB1.598 s, 2.7 MB
datagrams of 1 KB, async1.725 s, 2.2 MB1.753 s, 2.2 MB1.707 s, 2.9 MB1.641 s, 2.5 MB1.636 s, 2.7 MB
datagrams of 1 KB, blocking1.617 s, 2.1 MB1.616 s, 2.1 MB1.608 s, 2.3 MB1.631 s, 2.5 MB1.630 s, 2.7 MB
datagrams of 8 KB, async1.838 s, 2.3 MB1.830 s, 2.3 MB1.788 s, 3.0 MB1.714 s, 2.6 MB1.725 s, 2.8 MB
datagrams of 8 KB, blocking1.702 s, 2.2 MB1.702 s, 2.2 MB1.701 s, 2.5 MB1.724 s, 2.6 MB1.714 s, 2.8 MB
10,000,000 addresses, read and written1.487 s, 2.0 MB1.625 s, 2.0 MB2.006 s, 2.2 MB1.535 s, 2.1 MB2.107 s, 2.2 MB
Size, stripped150 KB166 KB938 KB377 KB474 KB
Lines559559529331331

Rust is std::net where the functions block, a thread for each task, and tokio 1.54.1 with the runtime of several threads #[tokio::main] makes where they are async; Zig is std.Io.net on Io.Threaded, its default, whose async functions are threads too (its loop on kqueue was not done on macOS). SG's lines are text, each checked to be UTF-8, as Rust's read_line checks it; Zig's takeDelimiter gives bytes, and without the check SG reads them in Zig's time. The async stream of 64 KB pieces takes 1.12 times tokio's time, and 50,000 connections one after another, async, 1.10 times Zig's: the time is in the calls of the system, and the difference lies most likely in where the tasks run, which Slower than C keeps for the work on servers. Before choices 1687 to 1690 the addresses took 2.262 s, a text made for every host, and 1,000 connections at once held 6.6 MB, each task carrying 600 bytes for each call of the network it waits in.