Changelog
Every user-visible change, by version. The plan for the versions ahead is in docs/versions.md.
0.4.3 — 2026-11-28
Step 0.4.3, loops and values in registers: a memory check in debug builds that stops at the first use of a freed value; every run fixture checked five ways in CI, and random valid programs run the same ways (seven daily seeds on the frozen release, rerun until all agreed; the three bugs they found fixed: an element of a list in registers assigned with an index of unknown type, a list released inside a later argument of the call holding it, and list headers and record fields read as never-changing memory, which let a read move past a release; that last fix gave back some speed, accepted by the owner: lcs up to 20% slower, regex 5–6% on one core); and the held-out set (40 programs written plainly, never used for tuning) made faster without a change to them: Mimic's time over C's on one core, as a geometric mean, from 4.65× to 3.61× on Linux, 4.18× to 3.17× on macOS and 4.33× to 3.33× on Windows. Loops that grow a short list, tuples holding lists and the steps of qoi go through the Mimic IR; text mapped character by character is one pass (caesar 2.7× faster); a function value capturing nothing is made once; push onto a short list stays inline; Windows release executables are a third of their size; ⍬ and x ⥊ [n] are typed; and tools/rc-count.py counts the values made in loop steps. Moved to 0.4.4, with the owner's approval and recorded in docs/versions.md: qoi within 1.5× of C and paths within 1.3× (now 1.9× and 1.75×), escape analysis, loops making no values in their steady state, and the gaps.md rows still open for 0.4.3.
Added
- Values made in loop steps, counted: a
MIMIC_COUNT_RC=1build also counts the values made while anevolveorsettlestep runs (past each loop's first step, which may copy a start still shared elsewhere), andtools/rc-count.pylists the benchmarks whose loops make any in their steady state. - A matrix row assigned in one write:
m[i] = [10 40 70]replaces rowi(a number fills it; with more dimensions, fewer indices than dimensions replace that cell,cube[1, 0] = [7 8]), copied first when shared, a byte matrix keeping bytes. It stopped the program withneeds one index per dimension; a list of the wrong length says how long the row is. - Character literals:
`a`is the number 97 (a character's code, aschar_code("a"); escapes`\n`,`\,\x1b,\u{e9}). Text work on bytes compares and computes with characters as numbers,(c -a+ 13) % 26 +a``, instead of making a one-letter string for each one. ⍬, an empty list with a type (digraph\z):⍬is an empty[i64],⍬[f64],⍬[str],⍬[Point]an empty list of that element type. A bare[]has no element type and, where nothing gives it one, sent the code using it the slow generic way; the prelude's[0] ↓ 1(and[0.0] ↓ 1, …) for an empty typed list is now⍬.- Every keyword has a glyph, each with a digraph:
⇑pub,⇄mut,⍰if,⋄else,⏎return,⇐use,≔as,⌁extern,☡unsafe,✓trusted,⊡type,⊨match,⊕with,●true,○false, and⊢test,∀for (property tests),⎘include, beside§module andƒfn. Words and glyphs mix freely;mimic fmtwrites glyphs back as words,mimic glyphslists them all, and the editor grammars (TextMate, tree-sitter) colour them as their words. e else { … }is an expression: the value inside anOptionorResult(Some,Ok), else what the block gives, anywhere an expression goes:if 1 < ≢ args { parse_int(args[1]) else { 1086 } } else { 1086 },xs ¨ (s => parse_int(s) else { 0 }), andlet port = parse_int(s) else { 8080 }(the block may still leave withreturn, aslet … elsedid). The block must give the type inside (E0401) or something (E0504); a value that is not anOptionorResultis E0406.Resultgets its fallback this way too.- A memory check in debug builds. A freed value is marked, filled with junk and kept a while before its memory is used again; retaining, releasing or reading it afterwards stops the program at once, naming what was done and what the value was (
memory check: a value ([i64], 4 elements) was read after it was freed).mimic lldbstops right there, with the stack. Release builds are unchanged. - Random programs, nightly (
tools/fuzz.py, thefuzzworkflow): valid programs written at random (numbers, lists, functions that call themselves with a list they grow, copies changed in place) run in release and debug, without the Mimic IR, on one thread and on many; all must print the same. A disagreement is kept with each way's output, to become a fixture. math::to_bits,math::from_bits(andto_bits32/from_bits32forf32),bytes::of_f64sandbytes::to_f64s: a float's bits as an integer, and floats as little-endian bytes, both exact (weights saved and read back bit for bit).∧/and∨/, the and and or reductions (allandanywritten as glyphs, as in APL):same ▷ ∧/,∨/ flags.math::tanh,math::sinh,math::cosh,math::log1p,math::expm1andmath::sigmoid(libm calls that fuse into array kernels likemath::exp;log1pandexpm1exact near zero;sigmoidwithout overflow for large negative inputs), andunwrap_orfor anOption:parse_int(s) ▷ unwrap_or(300). Reported by a user.
Changed
- Text mapped character by character is one pass:
chars(t) ¨ (c => …) ▷ join(sep)with a function giving text walks the bytes oftonce, hands the function each character and appends its text at once: no list of one-character strings made, none joined. A pure function is asked once for each ASCII character, its texts kept for the rest of the loop. The held-outcaesar2.7× faster on one core;translitadded to the corpus for it. pushonto a short list stays inline: a list of numbers in one of the runtime's pools (up to 256 bytes) told the compiled code nothing of its room, so everypushonto it called the runtime, which looked up its block's size. The compiled code now knows the pools' sizes. A row grown to 45 numbers called the runtime for its first 32;levenshtein32% faster.- A function value that captures nothing is made once:
run(b, p, x => alpha(x) or digit(x))orrun(b, p, digit)made a new function value at every call and freed it after; one is now made the first time and shared, never freed.tokenize's scanning loop made 1.07 million values, now none; 8% faster. - A tuple holding a list, taken apart at once, stays compiled whole:
let (bytes, op) = chunk(p, prev), a tuple of 2 to 4 numbers, lists and records, no longer sends the function back to the old code generator. The Mimic IR calls the version of the callee that gives its parts (no tuple made) and holds each part as a value of its own, a part not named released at once.qoi'sencode_stepanddecode_stepare now compiled whole. In a record update, a short list kept in registers is appended with no list made for it,concat(s.px, p ⥊ [n])appendsncopies in place, and an empty list appended is no call at all. - A loop that grows a short list stays compiled whole:
first ▷ evolve(48, w => push(w, …)), its start a list of up to 16 numbers kept in registers and its state a list on the heap, puts the start on the heap once and pushes in place at each step. The loop went back to the old code generator, which copied the list at everypush:sha256's message schedule freed 97 values per block, now 1 (3.18 million values in the benchmark, now 33 thousand). gather(^),gather(&),gather(|)(andtrail) over integers fold in a loop, asgather(+)does: the runtime's generic fold called a function value with two boxed numbers for every element.siphash(hashes ▷ gather(^)): reference-count operations from 4 million to 8, 25% faster on one core.[256 -1 255]is three numbers: in a list written out, a-with a space before it and a digit right after is a negative element, not a subtraction (which gave[255 255]with no error).[a - 1],[a-1], an indexxs[n -1]and parentheses inside a list still subtract;¯1works everywhere as before.- A list of strings written out and indexed at once makes only the element picked:
["" "-alpha.{k}" "-beta.{k}"][i], its elements literals, variables or text formatted from them, is a switch onithat formats one string, not the list and every string in it (an index outside it: the list made and indexed as before, the same error).semver: reference-count operations from 41 million to 20 million. - A list of lists no longer sends a function back to the old code generator: the Mimic IR holds, passes on and releases it as any other list (its rows read by the old path, as for a list of strings), so the rest of the function is compiled through the IR.
vm, whose program is a list of[operation, argument]pairs: its machine loop compiled whole, reference-count operations from 46 million to 51, 4× faster. - A loop whose state is a record or short list kept in registers is compiled whole, a short list read and changed at any index there too:
xs[i]andput(xs, i, x)on a list of up to 16 numbers kept in registers (a machine's tape in its record) are checked against its length and stay in registers, so a step changing it no longer builds the whole state on the heap to do so. A loop's first state with an empty list in it,(0, []), takes the list's type from the step.brainf: reference-count operations from 42 million to 5 thousand, 3× faster. - A tuple of a list and a number (and such: 2 to 4 numbers or values on the heap) is returned as its parts: where the caller takes it apart at once (
let (p, root) = find(parent, i)), the function gives its parts in registers, with no tuple made, filled, checked and freed; a tuple written out as the result, in any branch, or handed on from another such call, makes none. A caller that keeps the tuple gets one, as before. Held-outunionfind6.2 s → 3.2 s,bfsgrid1.3 s → 0.45 s,textstats18% faster. char_of(n)of a number takes it as it is: no boxed number made and checked for each character (the same errors for a number that is not a character). The held-outcaesar12% faster.- A list of truth values is typed as one when passed or returned: a parameter declared
[bool]given[](or a list of unknown type) is compiled for[bool], the list converted once at the call, and a function declared-> [bool]gives back a typed list, as[i64]and[f64]already did. The held-outbfsgridread its walls through the generic path at every step: 2.0 s → 1.3 s. joinwrites its string once: the length is added up first and the parts copied into the new string, instead of a buffer grown (and reallocated) as it goes and then copied again. A word of a few letters joined millions of times: the held-outtextstats24% faster.v[i] = xon alet mutlist of numbers is written in place, with nothing counted per step: the number stored directly where the list is held once (else copied first, as before, with the same errors);v[i]read without a reference of its own; andlet mut v = xs, changed and then handed on (fill(n - 1, y, v)), moves the list there instead of keeping a reference. The held-outhistogramabout 15 times as fast.xs ¨ fover a list of lists is one compiled loop (split over the cores when long): each row is lent tofas it is, a lambda that captures or a named function, which returns a number, a truth value, a string or a record (g ¨ (row => row[c]),rows ¨ group_ok). The held-outsudokucheckabout twice as fast.xs ¨ fover a list of strings is one compiled loop (split over the cores when long), as it already was over numbers and records:f, a lambda that may capture values (chars(text) ¨ (c => shift(c, k))), gets each string lent and returns its string or number directly, instead of one boxed call per element with its arguments checked each time.markdown,soundexandtemplate17–29% faster; the held-outcaesarfrom 50× C to 35×.settleandevolveover a record or a list are compiled through the Mimic IR, as they already were over numbers and values kept in registers: the loop holds the state, each step takes it on (changing it in place) and the first state is left as it was when it is still read after the loop. A record built from short lists (S { heap: [x], … }) goes through the IR too.paths' search is in the IR now.concat(s.f, v ⥊ [n])on a record's list of numbers writes thencopies into the list itself when the record holds it alone: no list of them is made first and joined (qoi's decoder repeating a pixel for a run).if c { [x] } else { [] }taken at every step allocates nothing for the[]: a[]typed by the branch next to it is one shared empty list, made once (a change to it copies, as to any shared list), andconcat(s.out, flush)with an emptyflushleaves the record's list as it is, without a call. A QOI encoder's flush of a run: 46 ms → 29 ms a frame.- A small helper returning a tuple, unpacked just before a record update, no longer allocates:
let (bytes, op) = chunk(p, prev)followed by{ s with out: concat(s.out, bytes), ops: put(s.ops, op, …) }inlineschunkand makes the update in each of its branches, wherebytesis a list of known length kept in registers and appended to the record's own list in place;concat(s.out, concat(flush, bytes))growss.outinstead of building the inner list.qoion one core: 0.87 s → 0.47 s. - A record's list grows in place when the new list is chosen by an
iffirst:let out = if k == 0 { push(s.out, x) } else { concat(s.out, ys) }followed by{ s with k: s.k + 2, out: out }gives each branch the update, so a record held once has its list changed in place (as{ s with out: push(s.out, x) }already did) instead of copied at every step. An LZ77 decoder'ssettleover a 512 KiB output: 1.71 s → 0.03 s. push,putandconcatof a short list on a record's list of numbers are done inline when the record holds the list alone and it has room: the numbers are stored and the length raised where the code runs, without a call into the runtime (asputon a variable's list already was). A QOI encoder written with them: 0.49 s → 0.35 s on one core.if c { xs } else { [] }is a list ofxs's numbers ([i64],[f64]or bytes), not a list of unknown type: the[]takes the other branch's type, as a literal number already did, so code using the result is compiled for its numbers instead of the generic path.- Lists of lists are typed by their rows (
[[i64]],[[f64]], a matrix built by⍳ n ¨ (r => ⍳ n ¨ …)):grid[r][c]is a bounds check and a load, where it was two lookups through the runtime with type checks. Conway's Life on a list of rows: 161–338× C before, 5.4× now. - Text one character at a time is faster:
charsandchar_ofshare one string per ASCII character instead of making a new one each time, andchar_codeof ASCII text is read in place (of a literal,char_code("a"), it is a constant). A Caesar cipher over 10 MB: 8.8 s to 3.2 s, 1.27 GB to 365 MB. put(xs, i, xs[j])changesxsin place when it is the list's last use, also as the first argument of another call (insert(put(xs, j + 1, xs[j]), j - 1, v)): the element is read first. It copied the list at every call; a hand-written insertion sort of 20,000 numbers went from 4.4 s and 3 GB to 0.37 s and 2.5 MB.xs ↑ kandxs ↓ kshrink the list in place where it is used for the last time and held nowhere else (a heap's pop,h ↑ (n - 1), copied the heap every time); a read guarded by anifafter the take (if n > 1 { rest[0] = h[n - 1] }) is made before it. A heap of a million numbers used over 4 GB; it uses 11.5 MB.- A float prints as the shortest text that reads back as the same number (
"{x}",print): 15 significant digits where those do, as before, and 16 or 17 where they do not, soparse_float("{x}")is alwaysx.0.1 + 0.2now shows as0.30000000000000004, as in Rust, Go, JavaScript and Python. - A list returned in a tuple, or handed back to the function that holds it, is changed in place:
let (p, root) = find(…)movespat its one use, a list passed to the function itself or returned in its result is handed over, and a variable read by another argument of the same call (find(parent, parent[i])) is let go once the arguments are read. A union-find over a million elements used over 4 GB; it now uses 137 MB. - A pure
¨over a short list runs on one core unless its elements are worth sharing out: up to 16,384 elements, a function's first such¨is shared out as before while its cost per element is timed, and later ones go to the other cores only when that cost pays for waking them (else they run on one core, timed as they go). A sudoku check of 20,000 grids ran 6× slower on 12 cores than on one (about 4 s, mostly in the kernel); it now takes 0.7 s. push(push(xs, a), b)growsxsin place: the outerpushis given the list the inner one returned, held nowhere else, so it no longer copies it. A text of 10 MB built that way in a recursion took over 300 s; it takes 2.65 s.- Reads of a list are made before the changes that follow its copy:
let mut s = hthens[i] = h[j]s[j] = h[i](a swap), andf(push(h, v), ≢ h), now changehin place instead of copying it at every step; a heap's 20,000 pushes took 1.75 GB, now 2 MB. - A function whose last act is calling itself runs as a loop, however deep, in release and debug builds: what the call no longer needs (its locals, a string built on the way, a tuple's parts, a list copied with
let mut v = xsand changed) is released or handed over before the call, so the call becomes a jump. Recursions a million calls deep over lists, strings and records used to overflow the stack and stop with a segmentation fault; 11 of the 12 held-out programs that did now finish (sudokucheckno longer crashes but is slow). - A list of any element type grown by
push(or changed byputorconcat) where it is used for the last time is changed in place, strings, floats, records and maps included:gen(n - 1, y, push(acc, v))hands the same list down the recursion instead of copying it at every step (before, only lists ofi64were, so building a list of strings this way took time and memory growing with the square of its length). A map threaded through a recursion withputis changed in place too. Found by the held-out set (BENCHMARK.md): most of its programs build their input this way. - A parameter declared as a list of numbers (
xs: [i64],[f64]) is that list: given a list of unknown type ([], the result offlatten, a list grown from[]), the function used to be compiled for the unknown type, on the generic path, and the declaration only checked; now it is compiled for the declared type and the call converts the list (a list already of that type is passed as it is).bigfactorialin the held-out set (a list of digits started as[]): 39 s → 0.9 s. Reported by a user too (bytes: [i64]showing as[?]).
Fixed
- A list read inside a later argument of the call that takes it is not released there: in
put(acc, 0, if c { acc[0] } else { +/ acc })the reads in the value counted as the list's last use, so it was released whileputheld it, andputwrote into freed memory (a crash, or wrong numbers). A use is now the last only when every other use runs before it. Found by the nightly random programs. - A list's length is never read after the list is gone: header loads were marked as reading memory that never changes, so the optimizer could move a
≢past the release of its list and read the next list made in the same memory (≢ (push(xs, 8) + 7)gave another list's length). They are plain loads now, marked instead as reading headers, which the numbers a loop writes never touch (type-based alias information), so loops still keep them in registers. Found by the nightly random programs. m[i] = von a short list kept in registers, with an index or value of unknown type, stopped the program ("index: got unit value"): the general path read the list's numbers as a pointer. It now puts the list on the heap for the runtime and back. Found by the nightly random programs.- Windows release builds are about a third of their size: the MinGW libraries linked in carry DWARF debug information, and release links kept it (236 KB of a 372 KB hello world; real programs about 600 KB). Release
.exes now leave it out (keeping the symbolsmimic profilenames functions by): hello world 132 KB,qoi235 KB,http_route193 KB. Debug builds keep it. ⍬is a typed empty list:⍬,⍬[f64](andlet z: [i64] = []) were lists of unknown element type, so a function using one, or anifwith one as a branch, went the generic way. The empty list now takes the declared list of numbers.x ⥊ [n]of a number is a list of that number's type (0 ⥊ [64],prev ⥊ [k + 1]): it was of unknown type, which even letlet s: str = 0 ⥊ [3]through the check.- A
letan earlier pass left unknown takes its value's type: the checker types a function more than once, and a plainletjoined each pass's type with the one before, aslet mutdoes. An early pass, before a callee's result was known, leftif r > 0 { run_byte(r) } else { [] }a list of unknown type for good. - Deep recursion the net cannot take over no longer crashes: a function that calls itself other than last and gives back a list (or a tuple holding one) ran on the 8 MB main-thread stack and crashed past about 300,000 calls. The main thread's stack is now 512 MB, reserved and used only as it grows, on macOS (written into the executable, which is signed again), Windows (the linker's reservation) and Linux (the stack limit raised at start): 1,000,000 calls deep take 34 MB, 5,000,000 take 160 MB.
- A
settleorevolveloop made through the Mimic IR put its exit between the test and the step, andsieve's crossing-out loop ran 8–9% slower on Linux than in 0.4.2; the exit comes after the step again. evolvewith its arguments swapped,x ▷ evolve(step, n), is an error (E0401, saying the count comes first) instead of a program that never runs the step; a number, string or list given wheresettle,evolve,gather,trailor¨needs a function is an error too.fs::temp_dir()was/tmpon Windows, which does not exist there; it is the user's temporary directory (TMP,TEMP).k ↑ xsandk ↓ xson a list of records (the count on the left) stopped the program with "take/drop count must be an integer scalar"; the count may be on either side, as for lists of numbers._binds nothing: a value dropped on purpose can go to_any number of times in a function (the second_ ← …was E0302).- A local bound to a field of a borrowed record (
let a = f.optwhere the record holds lists), handed to an expression the IR embeds, was released twice: memory corrupted, a later unrelated call crashed. - A program that crashes (a bad memory access, a stack overflow) now flushes what it printed, names the signal on stderr (
mimic: the program crashed: SIGSEGV …), and keeps the signal's exit status;mimic testreports a test that died from a signal as crashed. - A value read in a
matchguard and used again by a later arm could be handed over in the guard and be gone in the later arm (Prop(k, v) if k == name => …, _ => prop(rest, name)). - A short list grown past the smallest memory pool (a word built letter by letter) kept a 4 KB block that was never given back when it was freed: 180,000 such words held about 1 GB until the program ended. It now moves to the next pool.
mimic fmt(and formatting from an editor or the MCP server) leaves a file that does not parse untouched and reports the parse error;fmt --glyphshad rewritten∧/into∧÷.- A primitive's word is refused wherever a name is declared (E0214): a parameter or a typed
letnamedshape(the word of⍴) was accepted, then every use of it was the primitive, with a misleading parse error (expected an expression, found '=='). Functions, parameters,lets and lambda parameters now all give E0214 naming the primitive. Reported by a user. - A function named like a built-in primitive is refused (E0214):
fn matmul(…)compiled, but everymatmul(…)elsewhere is the primitive⊠, so the function could never be called and nothing said so. It is now an error where the function is declared, naming the primitive. (C functions keep such names underc::.) - Stopping
mimic runstops the program: on macOS and Linux the program now takes the place ofmimic runinstead of running as its child, sokill, a time limit or a closed terminal ends the program itself (before, onlymimicstopped and the program kept running, holding its memory), and the shell sees the program's own exit status.
0.4.2 — 2026-11-24
Step 0.4.2, ownership by analysis: in the functions the Mimic IR compiles, a list or record is released right after its last use, handed over instead of shared, and changed in place wherever nothing else holds it, through helper calls, record updates and branches, in debug builds as in optimised ones. Text and functions that call several others now go through the IR too, numbers and literals that live for the whole run are never counted, and operators on values of unknown type no longer allocate their results. Reference-count operations over the corpus fell by 40% (937 million to 563 million, short of the halving the plan aimed at; what is left is mostly in code the IR does not cover yet). mimic check --copies lists the copies a program still makes and why: paths' step makes none; qoi's steps are still compiled by the old code generator (they wait for typed empty lists and tuples holding lists, 0.4.3–0.4.4). sudoku 1.9× faster, vm 1.7×, tokenize 1.5×, totient 1.3×, paths 1.27×, hull 1.2×, lz77 1.18× on this machine; the whole corpus on Linux, macOS and Windows is in BENCHMARK.md.
Added
mimic check --copieslists every copy of a list or record the program still makes, where, and why: aput,pushor{ … with … }on a value used again later (and at which line), read from outside a loop, or borrowed from the caller. Functions the compiler does not analyse yet are listed with the reason.--emit-jsongives the same as JSON.
Changed
- A step function takes its record state wherever it hands it on or updates it last: a record parameter read first (
let p = ps[s.i],s.v[i]) and then passed to a function that changes it, or used as the base of a{ … with … }, is now taken over, so the change is made in place instead of on a copy:look(look(s, 0), 1),{ grow(t, at) with k: t.k + 1 },let e = learn(d, c)aftercodes[d.i]. And a field changed in one branch and kept in the other (next: if d == 0 { push(k.next, w) } else { k.next }) is two updates, the one taken in place. These shapes took minutes in 0.4.0 (docs/gaps.md); the corpus already avoids them. - A list field changed under a
letand stored back is changed in place:let table = put(s.table, h, x)then{ s with table: table }copied the whole list (the record still held it when theputran); the change now happens in thewith, which takes the field out of the record, so it is made in place when nothing else holds them. The same for chains ofputandpush, and{ s with out: concat(s.out, ys) }now appends in place in the functions the IR compiles.lz77is 15% faster (its table of 65,536 entries was copied for every byte). - Values are released as soon as they are last used, and handed over instead of shared (docs/design/ownership.md): in the functions the IR covers, a list or record is freed right after its last use (not at the end of its block), given as it is to a function that takes it over, and stored into a record without a new reference. A field read borrows its record. Records on the heap,
{ r with … }and functions that take over a record argument now go through the IR;floydis 1.26× faster. putandpushon a list ofi64change it in place when nothing else holds it: a list the function owns at its last use (let g = push(h, x),put(put(h, p, b), i, a)) is changed where it is, and{ s with v: put(s.v, i, x) }stores the number in place without a call. A function whose list parameter is changed this way at its last use (a heap's sift-upup(put(put(h, p, b), i, a), p)), or handed on to one that is, now takes the list from its caller, so the change is in place there too. Before, a bareputalways copied the list.- Releasing a number,
true,falseor a literal no longer calls the runtime: these values live for the whole run, and compiled code now skips them where it releases a value. They were half or more of all reference-count operations invm,soundexandurl;vmis about 4% faster. - Text, and functions that call several others, now go through the IR: functions that take or return strings, and blocks with more than one call (only blocks the compiler would actually run in parallel, or start as a task, stay on the old path), now get release-at-last-use and in-place updates.
sudokuis 1.9× faster,paths1.27×;put/pushon a list a function only borrows copies it directly instead of taking a reference first.MIMIC_IR=whyprints why a function stays on the old path. - Comparing or computing with two numbers of unknown type no longer allocates: an operator on two single values whose type the compiler does not know (
op == 0in an interpreter's loop) gave a new value every time; a truth value or an integer from such an operator, and fromnot,-and∣on one value, is now the runtime's owntrue/falseor cached small integer.vmis 1.7× faster (8× fewer values freed),tokenize1.5×,brainf6% faster.
0.4.1 — 2026-11-22
Step 0.4.1, the Mimic IR: programs are now compiled through a typed intermediate representation between the syntax tree and LLVM, on by default, with fusion as a pass over it. Array code computed element by element (⍳ n, operators on lists, xs ¨ f, reductions) is fused by the IR, across lets and small helpers it inlines; what the IR does not cover yet is compiled by the old code generator where it stands, until that is retired (0.4.10). Also a security fix for the HTTP client's redirects, and the slowest benchmarks of 0.4.0 traced and most of them made several times faster without a change to the programs: tuples of numbers and short lists stay in registers, lists grown in a loop and lists from flatten stay typed, let lambdas and count's lambda are compiled as functions, gather/trail with a lambda are typed loops, and debug builds change lists in place. fnv1a, crc32, adler32, pagerank, topo and siphash 7–25× faster, sha256 13×, diff 7×, utf8 5.6×; no benchmark slower on Linux, macOS or Windows.
Added
- The Mimic IR (docs/design/ir.md): a typed intermediate representation (SSA, with structured control flow) between the syntax tree and LLVM, with passes over it: fusion, sinking (work moved into the one branch that needs it) and inlining of small helpers.
MIMIC_IR=printshows each function's IR,MIMIC_IR_ONLY=textsends only the functions whose path holdstextthrough it.
Security
- The HTTP client keeps credentials to the server they were meant for. A redirect from
httpstohttpis refused with anErr(the request would go on unencrypted), and a redirect to another server (a different scheme, host or port) leavesAuthorization,CookieandProxy-Authorizationbehind; other headers still go along. Before,http::requestsent them on to wherever it was redirected.
Changed
- Programs are compiled through the Mimic IR: the functions it covers (numbers, values kept in registers, loops,
match, lists read and owned, reductions, lists computed element by element) go through it, and what it does not cover yet is compiled by the old path where it stands. The same output and speed;MIMIC_IR=0turns it off. - Fusion is decided by the IR: a list computed element by element and read once by a later computation is never built (
let ys = xs × 3,let zs = ys + xs,zs ▷ +/is one loop), nor is a small one read several times (computed again where it is read);xs ¨ ftakes part, and so does a small helper, inlined first (fn sq(xs) { xs × xs }thensq(v) ▷ +/is one loop). +/ ×/ ⌈/ ⌊/of a list of numbers is the fused engine's kernel (SIMD, split over the cores) instead of the runtime's generic call, its result unboxed.- Lists grown in a loop stay typed:
pushof a number onto a list of that kind of number gives such a list, a loop whose list state changes length (⍳ 16grown to 64 bypush) keeps it typed, and a tuple holding short lists of known length ((i, [8 words])) stays in registers.sha25613× faster (4.7 s → 0.35 s). - A function declared
-> [i64](or[f64]) returns a typed list: a body joining[]with[x]gave a list of unknown type, which the declaration only checked, so the caller worked on boxed values. The result is now made typed as it is returned.diff7× faster (3.8 s → 0.54 s). A function that returns something else under such a declaration now stops at its return instead of later. flatten(xs ¨ (x => …))of lists of numbers is typed: its result had no known type, so everything after it ran on the generic path; when the lambda gives a list of numbers, the result is that list of numbers.utf85.6× faster (4.0 s → 0.71 s).gatherandtrailwith a lambda over numbers are a typed loop:ways ▷ gather((x, y) => (x + y) % p)sent every pair through the runtime boxed; a lambda that gives back the same kind of number as the list's is now typed and folded in a loop. 3,000,000 numbers: 2.35 s → 0.08 s. A lambda giving another type keeps the general path.count(xs, x => …)is typed and fused: the prelude'scountcalled its lambda as a function value for every element; given a lambda, the call is now written out as its body,+/ (xs ¨ (x => …)).maze5× andmarkdown1.2× faster.- A list of literals is built once:
["M" "CM" "D" …]or[1 2 3 …]in a function was built again on every call; it is now built the first time and shared after (a change to it copies, as to any list held twice).roman2.1× faster (3.2 s → 1.5 s of CPU). - A lambda kept in a
letand only called is a function:let at = (x, y) => table[…], thenat(a, b), called the lambda as a function value, every argument boxed; it now becomes a hidden function taking what it captures as arguments, specialised like any function. 8 million calls in a map: 5.8 s → 0.03 s. A lambda used as a value, or one that assigns, returns or sees a variable that changes later, stays as it was. - Tuples of numbers stay in registers: a
settleorevolveover a tuple state (a sequential pass, a hash, a binary search) allocated and freed a tuple on every step; a tuple of numbers and truth values is now kept in registers, as records of numbers are.crc326.8 s → 0.79 s,fnv1a4.5 s → 0.62 s,topo5.1 s → 0.79 s (one core, macOS). - Small programs build faster: a one-line program in about 0.45 s instead of 0.6 s on macOS. The linker runs inside
mimicinstead of as a second process (which took ~0.1 s just to start), and the macOS SDK and OS version are read from their files instead of askingxcrunandsw_verson every build (~70 ms).MIMIC_DEBUG_PHASES=1also times code generation, the runtime and linking.
Fixed
pushonto a short list no longer reallocates every time: a list that had grown past its first block kept askingreallocfor more room on eachpush, though it had plenty.levenshtein(rows built a number at a time) runs 2.5× faster on macOS, more on Windows.MIMIC_IRandMIMIC_DEBUG_DISABLEare part of the build cache's key: a program built with one of them could be reused by a build without it (and the other way round).- A redirect to
//host/pathgoes to that host with the request's scheme; it was taken as a path on the same server. ALocationtoo long to follow is anErrinstead of a cut-short URL. - Debug builds update records in place, as optimised ones do:
{ s with f: put(s.f, …) }copied the whole list on every step in a debug build (functions never took over their parameters there). A debug sieve of 200,000 took over ten minutes; now 1.8 s. - A program with only small maps no longer opens Metal on macOS: the GPU was asked before the map's size was checked, and asking opens Metal (~0.13 s). A program over 1,000 numbers ran in 0.14 s; now 0.01 s. Large maps go to the GPU as before.
0.4.0 — 2026-11-20
Stage 0.4.0, the measuring stick: a benchmark corpus of 130 everyday algorithms (hashing, parsing, graphs, text, interpreters, compression, numbers, simulations, geometry, images, data structures and dynamic programming), each in Mimic, C and Rust and checked against an independent reference; the machine's limits; and a speed gate on Linux, macOS and Windows that fails CI on a slowdown. The corpus found the bugs and slow paths fixed below, and the gaps left for the rest of stage 0.4 (docs/gaps.md). Its algorithms also became standard modules: hash, text, graph, order, parse, compress, and whole numbers in math.
Changed
- The standard library's own records hold raw numbers, as a program's do: its private helper records (the state of
hash,graph,compress,math::primes…) kept every number boxed, so their loops ran 2–15× slower than the same code in a program (math::primes(10000000): 5.0 s → 0.35 s;compress::rleof 4 MB: 1.2 s → 0.15 s). Public types, which the runtime builds too, keep their layout. sieveandkmeansare written as one would write them:sievekeeps its flags in bytes, as C does, andkmeanspasses its centres as a record. Both workarounds are gone now thatputon bytes is in place and a record passed along a recursion is borrowed.- The speed gate times short benchmarks longer: each side runs until it has run for a second (at most 30 runs) before the best time is taken. Benchmarks of 50–130 ms raised false alarms of 6–22% with the best of 3.
- The gate's noise is measured as the gate compares:
bench/run.py --noisenow runs the gate's comparison with the same compiler on both sides; a benchmark too noisy for the 25% limit on a platform is reported there, not gated. (The first noise data, ratios to C across whole rounds, overstated it, and a preview's identical compiler failed the gate ontreeandui.) - Benchmarks against C and Rust only: the Go versions are gone, from the suite and from the tables in BENCHMARK.md and on the website. The http benchmark's load generator is now a Rust program (
bench/http/load/main.rs).
Added
- Whole numbers in
math, from the corpus:math::gcd,lcm,powmodandmulmod(exact for anyi64, with 128-bit products),is_prime(Miller-Rabin, exact for everyi64),primes(a sieve) andtotient, checked against Python and sympy. Golden testmath_whole, docs/std.md and the tutorial. compress, from the corpus:compress::rle/unrle,compress::lzw/unlzw(12-bit codes) andcompress::varints/unvarints(zigzag LEB128 deltas), checked against reference implementations in Python, with every round trip and each decoder'sErrfor input it did not make. Golden testcompress_module, docs/std.md, the tutorial (chapter 16) and man pages.orderandparse, from the corpus:order::lower_bound,upper_bound,select(quickselect) andmerge, checked against Python'sbisectandsorted;parse::csv(RFC 4180, against Python'scsv),parse::url(againsturllib.parse.urlsplit) andparse::semverwithsemver_compare(against the precedence chain of semver.org). Golden testorder_parse, docs/std.md, the tutorial (chapter 6) and man pages.graph, from the corpus:graph::bfs,graph::shortest(Dijkstra with a binary heap),graph::components(union-find),graph::topo(Kahn's algorithm,Nonefor a cycle) andgraph::mst(Kruskal), on nodes 0 … n - 1 and edges as lists, checked against networkx on graphs of up to 20,000 nodes. Golden testgraph_module, docs/std.md, the tutorial (chapter 6) and man pages.text, from the corpus:text::distance(Levenshtein, by characters),text::find_all(every occurrence, overlapping, by KMP),text::soundexandtext::wrap(greedy, as Python'stextwrap), checked against Python and Soundex's published examples. Every loop is a loop in debug builds too, so a pattern that falls back far or a long name cannot exhaust the stack. Golden testtext_module, docs/std.md, the tutorial (chapter 6) and man pages.hash, the first module graduated from the corpus:hash::crc32,crc64,adler32,fnv1a32,fnv1a64,murmur3,xxhash32,xxhash64,siphash,md5,sha1andsha256on bytes, checked at every length around their block sizes against Python'szlib,hashlib,xxhashandmmh3and the published test vectors, in optimised and debug builds alike. Byte-by-byte loops run in chunks, so a debug build hashes any size without running out of stack, and an optimised one as fast as the benchmark's loop. Golden testhash_module, a section in docs/std.md and the tutorial (chapter 16), and man pages (mimic man hash).- The corpus reaches 130: 41 more everyday algorithms in Mimic, C and Rust, each checked against an independent reference: numbers (
gauss,millerrabin,coprime,totient,partitions,fibmod,catalan,polyeval,bigfact), simulations (shuffle,randwalk,ising,sandpile,rule110,traffic,langton), puzzles (tsp,sudoku,knight,matchain), graphs (mst,bellman,bipartite,flood,maze), data structures (lru,rangemin,intervals,bitset), text (roman,soundex,wordwrap,xmltags,markdown,template,lisp), hashing and ciphers (crc64,sha1,chacha20),base32anddct. On one core on the M-series Mac most are within 1-2× of C (intervals,mst,bellman,ising,partitions,sha1andbase32faster); the slowest are text built piece by piece (markdown4.9×,xmltags4.4×,soundex3.6×,roman3.5×),tsp4.2× (the table rewritten for each set size),sudoku3.8× (a new board for each placement) andflood3.4× (a pair made for each neighbour). Writing them found the fixes above, and gaps recorded in docs/gaps.md. - The corpus, more text:
zalgo(Z-algorithm),manacher(Manacher's palindromes) andanagram(anagram classes), in Mimic, C and Rust, checked against Python. On one core on the M-series Mac, against C:manacher1.9×,zalgo3.2× (sequential passes thatputinto a list held by a record: 0.4.3),anagram6.5× (half a million words built letter by letter as strings). - The corpus, geometry:
hull(convex hull by monotone chain),pip(point in polygon by ray casting) andsegments(segment intersection, all pairs), in Mimic, C and Rust, in exact integer arithmetic, checked against Python. On one core on the M-series Mac, against C:hull0.75× (sorting one number per point),segments1.1×,pip1.3×; on all cores 2.2–4.5× faster than C. Found on the way:(a > y) != (b > y)is refused as a chained comparison, and a long condition cannot be split over lines except inside parentheses (docs/gaps.md). - The corpus, more parsing, and servers:
numparse,semverandini(checked against Python,iniagainstconfigparser), and two servers with their own load generators:http_route(a JSON API with path parameters and 404s) andhttp_echo(POST bodies answered in upper case), in Mimic, C and Rust (hyper). On one core on the M-series Mac, against C:http_echo0.96×,http_route1.6×,numparse2.4×,semver3.2×,ini4.0× (eachsliceandtrimmakes a new string: docs/gaps.md, 0.4.12); on all cores both servers match or beat the single-threaded C server. - The corpus, more compression and hashing:
varint(zigzag LEB128 deltas),bitpack(13-bit values in 64-bit words),lzw,xxhash64,md5andsiphash(SipHash-2-4), in Mimic, C and Rust, checked against Python (xxhash,hashlib, and the SipHash paper's test vector). On one core on the M-series Mac, against C:bitpack1.8×,md51.4×,xxhash641.6×,varint3.9×,lzw3.8×,siphash22× (its rounds return the state as a tuple, which is allocated: docs/gaps.md, 0.4.3).bitpackpacks and unpacks as one parallel map each; the hashes loop with a function that calls itself, which is many times faster than asettleover a tuple. Found on the way: deep recursion through a function that takes a list or returns a tuple can still overflow the native stack past ~50,000 levels, with no message (docs/gaps.md); a type name for a tuple is not accepted. - The corpus, dynamic programming:
lcs(longest common subsequence, each row one map and onetrail(⌈)),coins(ways to make change) andlis(longest increasing subsequence by patience sorting), in Mimic, C and Rust, checked against Python. On one core on the M-series Mac, against C:lis0.7×,lcs1.5×,coins4.3× (a step thatputs into a list held by a record goes through the record each time: docs/gaps.md, 0.4.3). Found on the way:gatherwith a lambda goes through the runtime one boxed pair at a time (docs/gaps.md, 0.4.1). - The corpus, sorting and searching:
radix(LSD radix sort),bsearch(binary search, lower bounds) andselect(quickselect), in Mimic, C and Rust, checked against numpy. On one core on the M-series Mac, against C:bsearch0.9×,select1.6×,radix4.8× (everyputof its placing pass is a call into the runtime: docs/gaps.md, 0.4.3). A bottom-up merge sort is written but waits for lists built from pieces to keep their type (docs/gaps.md). - The corpus, images:
histeq(histogram equalization),rotate(90° turns),dither(Floyd–Steinberg error diffusion) andintegral(a summed-area table and 8,000,000 box sums), in Mimic, C and Rust, checked against Python (numpy for all butdither). On one core on the M-series Mac, against C:histeq1.7×,rotate1.6×,dither2.2×,integral1.5×; on all cores each is faster than C (frames, rows and boxes run in parallel). Found on the way: a lambda kept in aletand called in a hot loop is 15–40× slower than the same named function (docs/gaps.md, for 0.4.1). - The corpus, data structures:
bloom,hashmap,heapandfenwick, in Mimic, C and Rust, checked against Python. Each updates a list in place step by step (evolvewith a named step,putthrough a record) and reads it in parallel. On one core on the M-series Mac:bloom1.5× C,hashmap2.1×,heap2.1×,fenwick1.9×. Writing them foundevolve/settlewith named functions copying the state at every step (fixed), and a list passed bare to a function thatputs into it being copied at everyput(docs/gaps.md). - The corpus, puzzles and tables:
nqueens,knapsack,floydandcollatz, in Mimic, C and Rust, checked against Python (numpy forfloyd). On one core on the M-series Mac:nqueens0.9× C (0.53 s on all cores, with the parallel map fix),knapsack2.0×,floyd2.9×,collatz2.4×. Writing them found two gaps (docs/gaps.md):settleover a tuple was 25× slower than the same loop as a recursion (collatz), and an index computed fromp div nandp % nin every element keepsfloydat 2.9× C. - The 0.4.0 corpus, text:
levenshtein,kmp,utf8,aho(Aho-Corasick),diff(Myers),trieandwordfreq, in Mimic, C and Rust with the same algorithms, checked against Python. Work that splits into independent pieces runs close to C on all cores (kmp1.07×), while one byte or cell at a time stays 22–36× on one core. - The 0.4.0 corpus, numbers and simulations:
sieve,montecarlo,blackscholes,heat,life,fft,kmeansandbigmul, in Mimic, C and Rust with the same algorithms, checked against Python (numpy, or its own big integers). Arithmetic over independent elements is at or near C on one core (montecarlo1.0×,blackscholes1.18×,kmeans0.84×) and several times faster on all cores. Writing them found four gaps (docs/gaps.md): a record used inside¨is retained and released for every element (20× the CPU time on all cores),puton[u8]copies,math::piwithout()passes the checker, and an FFT built from¨stages is 6× C. - The 0.4.0 corpus, graphs:
bfs,components,topoandpagerank, in Mimic, C and Rust with the same algorithms, checked against Python. Writing them found two more ways an update is copied instead of made in place (docs/gaps.md): anifinside{ … with … }(118 s against 7 s) and a helper that changes an array its caller's record holds. - The 0.4.0 corpus, interpreters and regex:
regex(a Thompson NFA engine, checked against Python'sre),brainf(a Brainf**k interpreter) andvm(a stack bytecode VM), in Mimic, C and Rust. An interpreter's loop is 27–54× C today (docs/gaps.md). - The speed gate:
bench/run.py --gate BEFOREbuilds every benchmark with the changed compiler and with the one it changes, times them in turns on the same machine, and fails on a slowdown beyond that benchmark's tolerance (twice its noise measured on GitHub's machines, 3–25%, frombench/noise/) in 2 of 3 measurements. The bench workflow runs it on release pull requests, nightly ondev, and on pull requests that change what is measured, and checks each time that the compiler without its optimizer (MIMIC_DEBUG_DISABLE=optimizer) fails it. - The 0.4.0 corpus, hashing:
crc32,adler32,fnv1a,murmur3,xxhash32andsha256benchmarks in Mimic, C and Rust, checked against independent references. They show sequential passes over arrays 13–57× slower than C and SHA-256 170× (docs/gaps.md, with the 0.4 steps that fix them), and that Mimic has nofold. - The 0.4.0 corpus, parsing:
csv,expr,tokenize,urlandhttp_parse, checked against Python'scsv,eval,reandurllib. Parsing that splits into independent pieces runs in parallel and is at or near C's time on all cores (csv0.90×,expr0.95×); scanning characters one at a time is 25× C on one core (docs/gaps.md). - The 0.4.0 corpus, compression:
rle,base64andlz77, checked against Python (base64, and reference implementations). They show where growing a list in a loop copies it: the LZ77 decoder is 476× C (docs/gaps.md).rlefoundflattenquadratic (fixed above).huffmanandbwtfollow:huffmanshowed asettlestep written as a lambda copying its state where a named step function changes it in place (37 s against 2.1 s). - The share of the machine:
bench/machine/measures the peak floating-point rate and the memory bandwidth, on one core and on all, and benchmarks that declare their work (meta.json: matmul, mandelbrot, prefix_sum so far) also show what share of that limit each version reached (bench/run.py --machinemeasures again). bench/run.py --jsonwrites a run's times as JSON, and--noise Nruns everything N times unchanged and records how much each ratio to C varies on the machine (bench/noise/<platform>.json; the bench workflow'snoiseinput runs it on GitHub's machines). It is the first part of 0.4.0: the speed gate's tolerances come from this measured noise.
Fixed
sort_indexon integers is several times faster: it boxed every key and compared pairs through the generic comparison; integers (and bytes) are now merged as (key, index) pairs in place, still stable. 2,000,000 keys took about 6 s and now take about 0.7 s, whichgraph::bfs,graph::topoandgraph::mstlean on.concatkeeps a list's kind, andpushcopies in one go:concatof two lists of the same kind of number gave a list of unknown type to the compiler, so every read of the result went the generic way: 5,000,000 reads of aconcatresult took 2.8 s, 0.02 s now (ChaCha20's block state, built byconcat: 9.3 s on one core, 3.1 s now). Andpushonto a list still in use copied it one boxed element at a time; it copies the elements in one go now (Catalan numbers by convolution, keeping the list in a local while it grows: 15 s, 2.3 s now).- A filter whose mask calls a function runs in parallel:
xs ⌿ (xs ¨ prime)was fused into one loop that computed the mask twice (to count, then to fill) on one core; 300,000 Miller-Rabin tests took 1.2 s that way and 0.08 s as a map. Such a filter now builds its mask with¨, in parallel; filters on plain arithmetic (xs ⌿ (xs > 0)) stay fused. pushonto bytes grows them in place: pushing a number onto a[u8]list copied the whole list every time (the number did not match the list's kind), so writing bytes one at a time was quadratic: 100,000 pushes took 0.63 s, and LEB128-encoding 4,000,000 numbers did not finish in 10 minutes. A byte pushed onto bytes held once now grows them in place (2 ms for 100,000); a value that is not a byte still turns them into a list of integers, as before.trailandgatherover numbers give numbers:xs ▷ trail(+)(and×,⌈,⌊, andgatherwith them) over a list ofi64orf64was a list of unknown type to the compiler, so every read of the result went through the generic path. A 256-entry table built bytrail(+)took 3 s to look up 8 million pixels; it takes 0.03 s now. The running results of an empty list off64are an empty list off64.evolveandsettlewith functions by name step in place:evolve(n, step)andsettle(step, done)with named functions called them as function values, which cannot take the state over, so a list in the state was copied at every step: a Bloom filter setting 7,000,000 cells of an 8 MiB list ran for over 15 minutes, andsettlewith a nameddonecopied even when the step was a lambda. They are now the same ass => step(s)ands => done(s): the Bloom filter takes 0.24 s.- A map whose first element is cheap still runs on all cores:
¨over up to 16,384 elements that each may be much work (they reach recursion) timed the first element alone and stayed on one core when it was quick. N-queens counted over its 225 first-two-row starts ran on one core because the first start, both queens in one column, costs nothing. It now times 1, 2, 4, 8, … elements and shares out the rest once that is worth waking the threads: 15 queens 4.55 s → 0.53 s on all cores. andandordecide before running their right side, whatever the types: where a side's type was known only when the program ran (a parameter without a type, a list fromflatten), both sides ran first, soj == ≢ xs or xs[j] > 0stopped the program reading past the end. The right side now runs only when it decides, as with known truth values; lists still go element by element. Found by a merge sort written for the corpus.flattenis fast for small lists too: making it linear (for many lists) made it slower on few small ones, each a parallel map, a running sum and a replicate:utf8, which flattens each character's bytes, ran 7.4 s on one core where 0.3.18 took 5.1 s. Lists that all hold one plain type (numbers, bytes, booleans) are now joined in one copy each:utf84.1 s (0.58 s on all cores),rle1.8 s (5.4 s before). Found by the speed gate comparing preview.2 with 0.3.18.- The README of a new project (
mimic create) links to https://mimic.codes, not the old repository address. - A record passed along a recursion is borrowed: a function that only handed a record on to its own recursive call took it over, so every call from outside retained and released it. Called from every element of a
¨, all cores wrote the same reference count:kmeanswith its centres in a record took 11 s on all cores (89 CPU-seconds), now 1.5 s (3.3), the same as with the lists taken out. puton a list of bytes is in place: an integer put into a[u8](or any value whose type differs from the list's) copied the whole list every time, even when nothing else held it. Thesievebenchmark with byte flags, as C keeps them: 2.9 s on one core (3.6 s with[i64]flags, over 2 minutes with bytes before) and 0.35 s on all cores.- Builds running at once could fail with
redefinition of 'MIM_UI_JS': each rewrote the runtime's cached sources while others compiled from them, and the C compiler, which tells files apart by inode, could take one file for another once an inode was reused. The sources of each runtime version are now written once, into a directory moved into place whole. --previewpicks only a release with files: the releases feed it reads also lists a tag whose release is still being built, so during the minutes a preview was building,mimic upgrade --previewchose it and failed with a 404. It now takes the newest preview or stable release whose files are there.- No release without its files: a release is now published only after its binaries and checksums are uploaded. Before, for a moment a new release could be the latest with nothing to download, and the install command failed with "Not Found" (the install scripts' check on the 0.3.18 release did). That check now runs when the release workflow finishes; it never ran on a release before.
- Builds at the same time no longer spoil the runtime: files Mimic writes "atomically" (through a temporary file) used a temporary name per process, so two threads of one build writing the same runtime file shared it and could interleave their bytes; CI saw
redefinition of 'MIM_UI_JS'once. Every write now has a temporary name of its own, the runtime's object file too. flattenis linear: it joined the lists two at a time, copying the growing result again for every list, so flattening many small lists was quadratic (200,000 pairs: about a minute; now milliseconds). Each element is now placed once, in parallel. The same in theuimodule. Found by the 0.4.0 benchmark corpus.
0.3.18 — 2026-11-17
Release channels: previews of the next version and nightly builds, alongside stable releases.
Added
- Release channels:
mimic upgrade --previewinstalls the newest preview of the next version (or stable, when it is newer) andmimic upgrade --nightlythe nightly build of the development branch; the channel is remembered, so latermimic upgrades stay on it, and--stablegoes back. The install commands take the same options (sh -s -- --preview,$env:MIMIC_CHANNEL = "nightly"on Windows). Stable stays the default, and previews and nightlies never reach the install command or the website unless asked for.
Changed
- How Mimic is developed: work comes together on a
devbranch through reviewed pull requests,mainholds releases only, and a nightly build and weekly previews keep each long step visible (docs/versions.md).
0.3.17 — 2026-11-17
Install and update Mimic from the terminal, from Mimic itself, and the editor extension with one command.
Added
- Install and update from the terminal:
curl -fsSL https://mimic.codes/install.sh | sh(macOS, Linux, WSL) andirm https://mimic.codes/install.ps1 | iex(Windows) install the latest Mimic or update to it (or say it is the latest), checked against the release'sSHA256SUMS, with--version,--check,--forceand--uninstall.curl -fsSL https://mimic.codes/vscode.sh | sh(vscode.ps1on Windows) installs or updates the extension in VS Code, Cursor, Windsurf and VSCodium. They avoid the update problems met before: a runningmimicreplaced safely, Windows'tarinstead ofExpand-Archive, Rosetta terminals on Apple silicon, musl Linux reported clearly, no GitHub API limits. Tested in CI on Linux, macOS and Windows. mimic upgrade: the same from Mimic itself (--check,--version,--force;--editorsupdates the extension too).
Changed
- The terminal library behind
mimic editis updated (ratatui 0.30), which also removes a low-severity advisory in one of its dependencies (lru).
0.3.16 — 2026-11-17
A speed round on byte, pixel and state-machine code (found with four new benchmarks and a video transcoding example), types on lambda parameters, and os::run_in.
Upgrading from 0.3.15: run the new release's install script (or update from the VS Code extension 0.10.5). Programs do not need to change. Release builds now change lists inside records in place where nothing else holds them; debug builds still copy, so a long state-machine loop is much faster with mimic run --release.
Added
- Example: transcoding a video into several resolutions (
examples/transcode): ffmpeg alone, and ffmpeg decoding and encoding around Mimic's own scaler (every plane of every frame, one parallel map), timed per resolution; the same in JavaScript (transcode.mjs, worker threads) and a comparison (compare.mjs) that checks both produced the same bytes. Scaling 60 frames of 1080p to 720p, 480p, 360p and 240p: Mimic 1.23 s on all cores, 6.43 s on one; JavaScript 4.06 s and 12.09 s; C on one thread 5.00 s. - Benchmark
scale: video frames resized bilinearly (C, Rust, Rust + Rayon, Go, Mimic). - Benchmarks
filters,qoiandpaths: a 1080p image through box blur, Gaussian, Sobel, median and bilateral filters; a QOI encoder and decoder; Dijkstra and A* with a binary heap on a 600×600 grid (C, Rust, Rust + Rayon, Go, Mimic; the same output from each). - Types on a lambda's parameters:
(w: f64, h: f64) => w * h, checked like a function's (error E0401 names the parameter). os::run_in(dir, program, arguments):os::runin another working directory; a missing folder is anErrthat names it.
Changed
-
Byte data is fast. Lists of bytes made by a fused loop are written with SIMD too. Reading an element of a
[u8]was a call into the runtime that allocated a number (now one load: the scale benchmark went from 10 s to 1.4 s);bytes::from(…)over a computed list writes the bytes in one pass, without a list of i64 in between; sums, products, maxima and minima of integer lists run as tight loops. The sum of a[u8]is ani64(it was typed as a list, which sent the code around it to slow paths). -
Loops whose elements are big pieces of work use every core:
⍳ 30 ¨ framewhere eachframeworks over a million pixels ran on one core, as 30 elements looked small. An element whose function itself loops over arrays is now timed and shared out (2 → 6 of 12 cores in the scale benchmark). -
The function a fused
¨applies goes inside the loop (inlined), so its checks that do not depend on the element (divisors, the lists' headers) leave the loop. -
Integer
divand%of numbers that are not negative take a plain divide, without the correction that rounding towards minus infinity needs (the results are the same); LLVM drops or hoists the test where it can. The transcode example's scaler: 8.8 s → 6.4 s on one core. (Replacing a divide by a precomputed reciprocal, as C compilers do for constant divisors, was tried for divisors fixed in a loop: slower on both Apple's arm64 cores and AMD's x86 ones, whose dividers are fast; left out.) -
let (a, b) = …of numbers stays in registers, from a tuple or anifwhose branches are tuples: in a loop over pixels it made, checked and released a tuple per pixel (the transcode example's scaler: 116 s → 0.9 s). -
State machines change their lists in place.
{ s with xs: push(s.xs, x) },concatandput(and chains such asput(put(s.xs, i, a), j, b)) take the list out of a record held once and change it there, growing it with room to spare, instead of copying it each time; a list still held elsewhere is copied as before, so results never change.settleandevolvehand their state to each step (a record held once),settlewith a typed step is a compiled loop (it went through the runtime), and a function takes its record parameter over when eachwithon it, or a call it is passed to, is its result on that path. Dijkstra with a heap on a 600×600 grid went from not finishing in 10 minutes to 0.4 s; a QOI encoder from hours to 1.4 s. -
Small pure helpers stay native. A pure function making several calls at once (
slot(p)callingred,green,blue) went to the interaction nets even without any recursion in reach, where each call cost thread wake-ups; the nets are kept for work that can grow. -
Lists of up to 16 numbers stay in registers (it was 8): a 3×3 neighbourhood or a 4×4 matrix allocates nothing.
sortof such a list sorts on the stack;sort(⍳ 9 ¨ f)[4](a median) allocates nothing; the runtime sorts lists of up to 64 numbers with an insertion sort (the radix sort allocated and cleared buffers). The median filter: 5.5× → 1.6× C on one core, on par with Rust + Rayon on all cores.
Fixed
- A fused loop shared out over the cores could compute wrong numbers and crash when it used a list or a record small enough to be kept in registers (
nbody's bodies): such a value is wider than one slot of the kernel's context and overwrote the next ones. It now goes by address. (Found when today's change sent more loops down that path; a small constant loop like⍳ 5is not counted as heavy work.) panicandos::exittake no part in a value's type:match fs::read_bytes(p) { Ok(b) => b, Err(e) => panic(…) }was dynamic (the arms joined bytes with nothing), so everything computed from it ran on slow paths; it is[u8].
0.3.15 — 2026-11-16
Updating while an editor is open works again, and/or short-circuit, servers can be profiled and stopped, lists of number-only records are 9× faster, and fixes from first users' notes.
Upgrading from 0.3.14: if updating from the VS Code extension failed ("Killed: 9"), update again: this release's installer replaces mimic safely while the language server runs. In VS Code, install the extension 0.10.3 for the profiler's Cancel. One change can stop a program from compiling: standard functions now check their arguments' types (error E0401), so a call that passed the wrong type, and would have failed when run, is reported.
Fixed
- Standard functions check their arguments' types.
to_float(5)compiled and stopped the program when it ran (to_floatreads text); it is now error E0401, as for the program's own functions. matchon a list of pairs:[]and[(k, v), ..rest]cover every list, with no_ => …arm needed (a tuple of names matches every pair).- Clearer messages: a
{in a string that does not parse as code says that{starts an interpolation and to write\{for a brace; a syntax error says that names and types are checked once the file parses;mimic check src/some_module.miminside a project checks the project (it saidmimic run <file>expectsmodule main);mimic create mimic-lsmakes the projectmimic_lsin the foldermimic-ls(it refused the name). andandorshort-circuit.n > 0 and xs[0] == "x"readxs[0]even whennwas 0, and crashed on an empty list; the right side now runs only when it decides the answer, as in C and Rust. (On lists they still work element by element.) A pure function whoseand/orhas a right side that could fail or recurse (an index, a call, a division) is no longer put on the interaction nets, which evaluate both sides.- Profiling a server or a long program can be stopped. Ctrl-C during
mimic profilestops the program and still shows the report of the time it ran (before, the profile was lost).--stop-file FILEdoes the same when a file appears: the VS Code extension's profiling notification has a Cancel that stops the program and shows its profile, andmimic mcp'sprofiletool stops a program still running after itstimeout_sand reports up to there. - Updating Mimic while an editor is open. On macOS the installer copied the new
mimicover the old file, which the editor's language server was running; macOS keeps the signature it checked for that file, so the newmimicwas killed when it started ("Killed: 9", also when updating from the VS Code extension). The installer now writes a new file and moves it into place. On Windows, where a runningmimic.execannot be overwritten, the old one is moved aside first.
Added
math::to_int(x): a float's integer part as ani64, towards zero (math::to_int(math::round(x))rounds). There was no way to turn a float into an integer. NaN, or a number noi64holds, stops the program.- New tests: image filters (box and Gaussian blur, sharpen, Sobel, Prewitt and Scharr edges, the Laplacian, median and bilateral filters, and pipelines of them), a QOI image encoder and decoder, and Dijkstra and A* shortest paths; each checked against an independent implementation (byte for byte for QOI).
Changed
- Lists of records with only number fields are 9× faster. A record whose fields are all numbers (
{ id: i64, x: f64, v: f64 }) lives in registers; in a list it was boxed field by field on every step (each number allocated on its own, then copied into the record), and¨over such a list was not fused. Now a chain such asps ¨ step ¨ step ¨ stepis one pass with each record in registers, the sums after it are fused too, and putting a record back into a list stores its numbers directly. A million records moved five times and summed: 2.09 s → 0.23 s on one core, 26 million allocations → 2 million. Found withmimic profile.
0.3.14 — 2026-11-16
Faster servers, parallel recursion and prefix sums, and a mimic edit where everything is clickable. On GitHub's machines Mimic on all cores is now even with or ahead of Rust + Rayon on most benchmarks (BENCHMARK.md).
Upgrading from 0.3.13: run the new release's install script. Nothing in programs needs to change.
Changed
mimic editis easier to use: everything is clickable. A toolbar (Run, Test, Check, Audit, Find, Glyphs, REPL, Manual, ≡ Commands; icons only on a narrow terminal), a command list with every command and its key (F2, filtered as you type), folders in the file tree that open and close (src/and the open file's folders start open), tabs that switch and close with their ×, pane tabs,file.mim:12in any pane that jumps to the line, the error count and the hints in the status bar, the start screen's lines, and the items of every pop-up list. The wheel scrolls whatever is under it.- Prefix sums are faster: 0.28 s → 0.17 s (100 million numbers, 12 cores). A scan's chunks keep their fixed boundaries (results never depend on the number of threads), but each thread now takes one contiguous run of them, so the fresh output's pages are faulted in one region per thread instead of interleaved.
- Parallel recursion is faster:
fib103 → 80 ms (median, 12 cores). A function that splits into calls that run at once (fib(n - 1) + fib(n - 2)) now runs as fork-join when called from ordinary code, with less overhead than the interaction net; called from code already on the net, it stays there. Below the fork depth its calls run the plain sequential version, as on one thread, not the one that counts its depth on every call: on x86 that counting made parallelfibspend ~13% more CPU than on one thread (found on GitHub's Linux machines withperf statand pinned runs). - Servers are faster: 1.7–1.9× C → 1.10× C (the HTTP benchmark, all cores, M3 Pro). Every task waiting on a socket took one lock shared by all the event loop's threads, and held it through system calls (duplicating the descriptor, registering it with kqueue or epoll, closing it); under load a third of a server's busy time went to waiting for it. Socket waits now register, fire and close outside the lock, which only guards the timer heap; a wait with no deadline needs no lock at all. Found with
mimic profile --for.
0.3.13 — 2026-11-16
Stage 0.3 complete: the Workbench. The tools around the language, for people, editors and AI agents: the manual inside mimic, a language server, a VS Code extension, debugging from editors, an MCP server for agents, documentation written by people and agents, where code runs and why, an audit for quality and security, contracts and property tests, Mimic's own terminal editor, a REPL, a profiler, interaction nets you can see, and coverage.
Upgrading from 0.2.9: run the new release's install script (it replaces the old mimic and clears its build cache). In VS Code, install the Mimic extension 0.10.2 or newer; it finds this mimic by itself. Libraries can now be pinned to a tag or commit (mimic install <git-url>@v1.2.0, rev = in mim.mim).
Added
-
The Workbench engine and
mimic query(step 0.3.0): one analysis of the project that every tool will ask.mimic queryanswers as JSON:check,symbols,definition,hover,references,outline,docs,effects(pure, concurrent, ordered or sync) andstats.mimic query --servekeeps it running, reading one JSON request per line; files sent by an editor (open,change,close) are used instead of the disk, and only changed files are parsed again: an edit of the showcase project is re-checked in about 25 ms. While the program has errors, lookups use the last program that checked. See docs/workbench.md. -
Libraries at a chosen version, from git (step 0.3.1).
mimic install <git-url>@v1.2.0installs a tag, branch or commit next to other versions (~/.mimic/libraries/<name>@v1.2.0), andrev = "v1.2.0"in a dependency ofmim.mimpicks it.mimic installwith no URL, inside a project, installs every missing dependency that has agitURL (and theirs), at itsrevor at the commitmod.mimlocked, so a fresh clone builds with the same library code.mimic updatemoves a library to the newest commit of its branch and leaves tags and commits where they are. -
Workspaces: a
mim.mimwithworkspace { members = [...] }groups projects;check,build,test,fmt,installandmod updatein its folder run in every member, and all members build into its onetarget/. -
mimic man, the manual insidemimic(step 0.3.2): the tutorial, the reference and new guides, embedded in the binary, plus a page made from the compiler for every standard function (243) and module, every glyph (mimic man ⌿,mimic man keep,mimic man \k) and every error code.--searchfinds every line that mentions a text,--runruns a page's examples and compares their output,--jsonprints a page for tools. Every error message now ends with the page to read (For more about this error: mimic man E0303). -
Guides: "Coming from C", "Coming from Python", "Coming from JavaScript", and "Writing Mimic for agents" (the workflow, the idioms, and the mistakes ported code makes, with their error codes), in
docs/manual/. Their examples are checked like the tutorial's. -
Examples in comments are tests: a
// > expressionline and the valueprintwould show on the next comment line run undermimic test. -
Syntax highlighting (step 0.3.3): TextMate grammars for
.mimand.mnetin the new mimic-syntax repository (a submodule ateditors/syntax), for VS Code, Sublime Text and other editors, and later GitHub. Names from C (c::,cpp::,asnames) get a scope of their own. A tree-sitter grammar with highlight queries for Neovim, Helix and Zed. A golden test checks that the grammar highlights every glyph, word, digraph and keyword of the compiler, that every test program and example tokenizes with nothing unrecognised, and that tree-sitter parses them all with no error.mod.mimis marked as generated for GitHub. -
mimic lsp, the language server (step 0.3.4): errors as you type with the compiler's fixes as quick fixes; hover with signature, comment and effects (for C functions, their header; for glyphs and their words, what they do and how to type them); go to definition and find references, into the standard library; glyph input (\i→⍳) and completion of names, modules, words and keywords; formatting in the style the file mostly uses; the outline and workspace symbols; names from C as semantic tokens with the modifierforeign. Set-up for VS Code, Neovim, Helix, Emacs, Sublime Text and Zed:mimic man editors. -
The VS Code extension (step 0.3.5), in the new mimic-vscode repository (a submodule at
editors/vscode): everything ofmimic lsp, the highlighting and file icon, a glyph palette, Run and Run test above functions and tests, the Test Explorer (tests and examples in comments, with both sides of a failedexpect), the manual beside the code, conversion between glyphs and words, and a check thatmimicis new enough. CI runs it in a real VS Code against themimicit builds. -
Debugging shows Mimic's values (step 0.3.6).
mimic lldbshows text, lists, maps (["a": 1, "b": 2]), records (also those kept in registers, which had no debug information before:Point { x: 1.5, y: 2.0 }), lists of numbers as[3 1 4]and variants asSome(7), without the handles' addresses.mimic dapdebugs from editors over the Debug Adapter Protocol (through LLVM'slldb-dap): breakpoints on.mimlines, stepping, the call stack, and the same values; in VS Code, F5 or Debug abovefn main. -
mimic mcp, Mimic for AI agents (step 0.3.7), over the Model Context Protocol: tools to check (every error with its exact fixes, as JSON), build, run (with input and a timeout), test, format, explain errors, read the manual and search it, look up symbols and effects, and read and write the project's files; resources (the guide for agents, the glyph table, every page of the manual) and prompts (write Mimic, port code to Mimic, fix the errors). Full access inside the project; outside it, files (--allow-outside), installing (--allow-install) and running programs that use the network or run other programs (--allow-network) stay off until allowed;--read-onlyand--no-runnarrow it. Set-up for VS Code, Cursor, Windsurf, Zed, Codex CLI and any MCP app:mimic man mcp. -
Documentation written by people or agents (step 0.3.8). Guides, Markdown pages in the project's
docs/folder, joinmimic docbeside the API; theirmimic runexamples run undermimic testagainst theiroutputblocks. The site is new: guides and modules in the sidebar, Mimic code coloured, every glyph explained on hover, Mimic's colours in light and dark;mimic doc --stdincludes the manual's guides. Throughmimic mcp, agents see what is undocumented (docs_status), write guides whose examples are checked as they are written (docs_write), and build the site (docs_build); thedocument_projectprompt starts the job. -
Where code runs (step 0.3.9).
mimic whylists every decision the compiler makes about a program or one function:¨on all cores, fork-join recursion, interaction nets, fused loops, SIMD, the GPU, implicit tasks, effects kept in order and the places that wait for tasks, each with its reason and what would change it. Code generation records these decisions as it makes them, andmimic whyreads them from a compile that stops before LLVM optimises. Editors show them as labels after the code (∥ parallel,⇶ fused,▣ GPU,◷ task,→ in order) with the reason on hover, and agents ask with thewhytool ofmimic mcp. -
mimic audit(step 0.3.10): quality rules (unused functions and variables, droppedResults, long, complex and duplicated functions, C functions that could bepure,trustedC functions taking pointers) and security rules (os::shellwith commands built from data, files opened with paths from HTTP requests, secrets in source, certificate trust outside tests,unsafeblocks, trusted headers, dependencies following a branch), each with a manual page (mimic man S01). Reports as text, JSON or SARIF;--fail-onmakes it a gate for CI (errors by default); a baseline counts only new findings; each run's counts are kept and compared. Agents get it as theaudittool, and CI audits the examples. -
Contracts and property tests (step 0.3.11).
requiresandensureslines before a function's body (resultis the value returned) are checked on every call in debug builds and tests, also when the body leaves withreturn, and left out of release builds; a broken one stops with the condition, the function and the line, and they show in signatures (hover,mimic doc).test "…" for xs: [i64] { … }runs the body for 100 generated inputs (i64,f64,bool,strand lists of them), the same on every run, and shrinks a failure to its smallest case. Both grammars knowrequires,ensuresandfor. -
mimic repl(step 0.3.13): Mimic a line at a time. An expression shows its value, aletkeeps it, afnortypestays defined, and an open bracket continues on the next line. Glyph input as you type (\i→⍳) and history with Up and Down;:showprints the session as a program,:reset,:man,:glyphs,:quit. Every line is compiled to native code and run; a line that does not compile shows its errors and is not kept. Inmimic edit, the same REPL is a pane: F4 evaluates a line you type, Ctrl-E the current line or the selection. -
The language server finds its way around: signature help, rename (the program's own names), the call hierarchy (who calls a function, what it calls), smart selection, the inferred type of each
letas an inlay hint with a code action that writes it in, and Extract into a function.mimic query typesgives those types to other tools. -
mimic profile --for SECONDS: profiles a server (or any program that does not end by itself) for that long, timed by the program. Servers are profiled properly: the event loop's threads and the tasks on them are sampled, and waiting for the network, for work or intime::sleepcounts as waiting. -
Targets:
aarch64-windowsis stable (CI runs every golden program on a Windows arm64 machine). -
mimic test --coverage: how often the tests ran each line of the program's own code, lines of functions nobody called included: a summary per file with the lines not run,coverage.jsonfor editors (the VS Code extension's Coverage run) andlcov.infofor coverage services. -
mimic repl --json: requests and answers as JSON lines, for notebooks and tools (the VS Code extension's.mimnbnotebooks). -
Windows: the language server compared Windows paths in their
\\?\form with the paths editors send, so errors and lookups could miss open files; paths are now compared and reported as editors write them. A test of the language server that hung for two hours on Windows CI (it waited for an answer to a malformed path) now finishes, and any test talking to a server stops it after three minutes without an answer. -
mimic net showandmimic net trace: the interaction nets of a program's pure functions (or of a.mnetfile) as text or as graphs (--json: nodes, ports, wires, active pairs), also as compiled before compile-time reduction (--before); and a call reduced round by round with the runtime's rules, giving the result, the interactions, the redexes of each round (the parallelism the net offers) and the rules that fired, with the net before each round for drawing (--frames). The VS Code extension draws and plays them. -
The VS Code extension 0.4–0.10: finds Mimic by itself (VS Code started from the Dock does not see the PATH of
~/.zshrc, so it asked formimic.path), installs and updates it from GitHub, shows errors on save with a Mimic without the language server, profiles (a panel, shares in the code, hot functions), lists where code runs, runs the REPL, and shows and traces interaction nets. -
mimic profile(step 0.3.13): runs the program and shows where its time goes: the share per function (self, and with what it calls) beside where the compiler runs it, the runtime and system functions that took it, each thread's share of time working, GPU kernels and their time, and memory allocated and copied. The runtime samples every thread about 1000 times a second (signals on Linux and macOS, suspending the thread on Windows) and follows the frame pointers a profiling build keeps; time on the pool's workers counts for the function that started the loop. The report is saved as JSON;--jsonprints it, andmimic mcphas aprofiletool.mimic man profileexplains it. -
Tail-recursive loops stay native. A pure function whose calls are all in different branches (a loop written as tail recursion) no longer runs on the interaction nets, where it gained nothing: it compiles to a loop, as fast as the same loop in C (a 400-million-step loop: 20 s on the nets on 8 cores' worth of CPU, now 10 s on one core, like C). Found with
mimic profile. -
Fused kernels are named after the function they come from (
…main__f$i$kernel3), in profiles and debuggers. -
Rust + Rayon in the benchmarks (step 0.3.13):
bench/<name>/rayon/is the hand-parallelised Rust version of seven benchmarks, timed on all cores next to Mimic on all cores inbench/run.py,BENCHMARK.mdand the weekly CI run. Cargo projects in the suite now build with-C target-cpu=native, as the single-file Rust versions do. Mimic is ahead on six of eight with no annotations; Rayon is ahead on prefix sum and fib. -
mimic edit, Mimic's own terminal editor (step 0.3.12): in Mimic's colours, with a MIMIC start screen; highlighting from Mimic's own lexer (names from C in their own colour); glyph input (\i→⍳, never inside strings) and a glyph palette; errors as you type from the engine (a mark, the code underlined, the message); panes for problems, the audit, where code runs (also as labels beside the code), the manual for the word under the cursor, and run and test output (in the background); tabs, a file tree, a fuzzy file opener, find and replace, undo and redo, the clipboard, the mouse, indentation that follows the code. Easy keys: Ctrl-S, Ctrl-Q (asking about unsaved files), Ctrl-O, Ctrl-G, F1, F5, F6.
Changed
mimic checkis about 2.5× faster (the showcase: 90 ms → 35 ms of analysis). Name lookups are remembered once the module tree is built, and names that turn out to be local variables no longer run the "did you mean" search, which only an error needs.
0.2.9 — 2026-11-15
Stage 0.2 complete: native windows on Windows and Linux, shared libraries, thousands of waiting tasks on the event loop, terminal programs, text formats, collections, C constants, globals, structs and unions, and Windows at full speed.
Upgrading from 0.2.0: names from C are now written with c:: (c::printf, c::sqrt). Run mimic check --fix in each project to add it where it is missing. The install script replaces the old mimic and clears its build cache.
Changed (breaking)
- Everything from C is written with the namespace
c:::c::printf(…),c::sqrt(2.0),c::Vec2 { … }, for functions fromextern "C"blocks, imported headers and C struct records alike. It is required, so C code is always visible, and C names never collide with Mimic's (c::absnext toabs,c::divnext to thedivoperator).extern "C" include "sqlite3.h" as sqlpicks another namespace. A C name used without it is error E0303 with the fix (did you mean c::floor?). C++ will usecpp::. To update code: putc::before each C function and struct name.
Fixed
- Windows programs run at full speed. Native Windows builds compiled for the plain x86-64 baseline (no AVX2, no FMA), because the MinGW host triple picked up Clang's cross-compiling defaults; they now use the machine's own CPU, as on macOS and Linux. On a Zen 3 runner:
mandelbrot1.14× → 0.76× C on one core,sum_of_squares4.1× → 1.1×. CI now checks which CPU Windows code generation used. - Windows: idle worker threads napped with
Sleep(0), which returns at once, so they spun on the cores the working threads needed; they now sleep 20 µs on a high-resolution timer (fibon all cores 0.89× → 0.68× C). - Parallel prefix sums (
trail) were slower on several threads than on one on Windows: scans now work in larger chunks (Windows 1.46× → 0.84× C on 4 threads; macOS and Linux a little faster too). - A rare hang on Windows: two tasks using one socket (a WebSocket's reader and writer) could switch its non-blocking mode under each other, and a read then blocked a whole event-loop thread. Sockets used by tasks now stay non-blocking.
- A coroutine's lock could be freed while the thread finishing it was still releasing it (harmless with glibc, not with Windows' threads library).
time::format's message for an unknown pattern code was cut off.bench/run.pywrites its results as UTF-8 on Windows.- Tests:
http_keep_alivetakes its port below the ones the OS hands out (it could race with a parallel test);c_struct_pointersusestermios.honly on Unix. "\033"and other C octal escapes were read as NUL followed by digits, silently; they are now an error that suggests\x1b.- Importing a C header failed when it declared a name Mimic uses itself (
divinstdlib.h, a fieldtype, a functionsum). Underc::(below) they keep their C spelling; a wrapper that cannot be written in Mimic is left out instead of failing the import.
Added
MIMIC_DEBUG_WATCHDOG=<seconds>: a program still running after that long prints every task and what it waits for (a channel, a join, a socket, a timer), to find hangs.MIMIC_DEBUG_CPU=1prints the CPU code generation chose.tools/speed-probe.pyand the manual "speed probe" workflow time benchmarks against C by thread count on CI machines.- Native windows on Windows and Linux:
ui::run(…, show: "window")(mimic run --window) uses Win32 controls on Windows and GTK 3 on Linux (loaded when the window opens, so programs do not depend on it), as AppKit on macOS. The same window test runs on all three in CI, Linux under a virtual display. - Shared libraries:
mimic build --sharedbuilds a library project aslib<name>.dylib,lib<name>.soor<name>.dll(with the import librarylib<name>.dll.a), exporting only itsextern "C" fns, for any language that calls C. Cross builds too (--target x86_64-windows). ¨over a function that waits on the network or sleeps runs every element as a task on the event loop instead of a core's worth at a time: 3000 WebSocket clients each holding a connection for half a second finish in about a second (was two minutes). Programs raise their open-file limit at start, so thousands of sockets fit.- Speed checked on Windows: CI counts AVX2/AVX-512 instructions in a native Windows build of the SIMD fixture, and the benchmark workflow runs on Windows too (
bench/run.pyworks there). - C unions: a record with one field per member (
c::Num { f: 2.5 }), by value, in structs and through pointers; the member set is the one C sees. - C structs: array fields are lists;
c::T { … }leaves fields out as zero (c::Termios {}); plain-data structs through pointers are records (const: copied in; otherwise copied in and returned, in a tuple with the result), soc::tcgetattr(0, c::Termios {})works. Records exist for every C struct the code names. mimic check --fixadds a missingc::(functions and constants).- C constants and globals:
#defineconstants and enum values (c::SEEK_END,c::M_PI,c::TIOCGWINSZ), computed by Clang and inlined; globals and expression macros (c::stdout,c::errno) read through generated getters;#definealiases of functions (c::CreateFile); C functions with uppercase names (the Windows API). Struct, callback and getter wrappers are generated only for the C names a program uses. - Collections:
unique,sort_by(stable,descending: true),zip,enumerate,any,all,count,group_by,flatten,min_by,max_by,clamp,to_map, and asetmodule (set::of,has,add,remove,union,intersection,difference). panic(message)andassert(ok, message)in ordinary code;os::env_all();fs::walk(dir)andfs::modified(path);time::format(t, pattern)(%Y-%m-%d %H:%M);random::choiceandrandom::shuffle.- Terminal programs without C:
io::write(no newline),io::flush,io::read_char,io::read_bytes; thetermmodule (raw,read_key,size,is_terminal,clear,move_to,show_cursor,alternate_screen, undone when the program ends), on Windows too (ANSI codes are switched on);os::on_interruptfor Ctrl-C. - Formats in interpolation, as in Python and Rust:
"{x:.2}","{n:>8}","{n:06}","{n:#x}","{n:,}","{x:.1%}";format(x, spec). A bad format is a compile error. char_code,char_of,pad_start,pad_end,words,slice,parse_int(text, base).docs/gaps.mdandtools/gaps.sh: everyday features checked against the compiler, each with the version that closes it.- String escapes
\x1b(an ASCII character by two hex digits) and\u{1F600}(any Unicode character), so terminal colour and cursor codes can be written. - TLS in static Linux programs:
https://andtls::work in--target x86_64-linux(and every other*-linux-musl) builds, through Mbed TLS 3.6 bundled inmimicand built for the target on first use. They trust the system's CA bundle, orSSL_CERT_FILE. - The Linux
mimicis built against glibc 2.28, so it runs on Linux systems from 2018 on (Ubuntu 20.04, Debian 10, RHEL 8 and later). NOTICElists the software bundled inmimic; release downloads include it.- The event loop on Windows: connections and the tasks they start run as coroutines (fibers), waiting on sockets through IOCP (wepoll) instead of a thread each, as on macOS and Linux.
0.2.0 — 2026-11-14
Downloadable builds for Linux, macOS and Windows; Windows as a target and as a host; static Linux and Windows programs proven in CI.
Added
mimic --versionshows the commit and the LLVM version.MIMIC_GPU_DEBUG=1reports whether a Metal GPU was found.- Windows programs from any machine:
--target x86_64-windows(andaarch64-windows) builds.exefiles with the bundled mingw-w64 (UCRT);mimic cccompiles and links C for Windows too. Threads, implicit futures, files, time and processes work. - Networking on Windows: TCP, UDP, HTTP, WebSockets and the browser UI through Winsock; TLS (
https://,tls::,serve_tls) through Schannel, checked against Windows' trust store;tls::self_signedkeys through BCrypt. os::shelluses the system shell:/bin/sh -c, orcmd.exe /con Windows.- CI builds the golden programs for Windows on Linux and runs them on a Windows machine (
tools/build-fixtures.sh,tools/run-fixtures.sh). - Downloads: a version tag builds
mimicfor Linux x86_64, macOS arm64 and Windows x86_64 and publishes them as a GitHub release with checksums. Each download has an install script (install.sh, orinstall.cmdon Windows) that putsmimiconPATHand checks what the system needs. - Stable targets: static Linux x86_64 and arm64 (
x86_64-linux-musl,aarch64-linux-musl) and Windows x86_64, whose golden programs CI now runs.mimic targetslists the Windows targets. mimicbuilds on Windows (MSVC Rust, a Windows LLVM from the llvm workflow); native builds there target MinGW (x86_64-windows-gnu) with this machine's CPU features. CI builds it and runs the golden programs it makes.
Fixed
- Windows: each socket call ran once, not twice (binding, sending and receiving failed or repeated);
os::pid()is the process id; listening ports are claimed exclusively; Winsock errors read as words. time::sleepnever returns early, also where the clock wakes a little early (WASI hosts).- The C version of the HTTP benchmark runs on Linux (epoll).
- Linux: C code (the runtime, imported headers) is compiled by the embedded Clang; the system compiler only links. Header import failed with GCC.
- Linux: a runtime function clashed with a glibc maths function (
jnl). - Linux: unused runtime code is dropped at link time, so raw
.mnetprograms link. - x86-64 release builds compile the runtime for this CPU with
-march=native. - LLVM's target list is registered once per process (concurrent registration could hang).
- compiler-rt builds for the same target in several processes at once no longer remove each other's files.
0.1.0 — 2026-11-14
The first version: the foundations listed in docs/versions.md.
- Language: arrays with glyphs and words, records, unions, generics, closures, functions as values, loop words, patterns, implicit futures,
testblocks. - Parallel by default: fused array kernels on all cores,
¨in parallel, fork-join recursion, interaction nets, SIMD across elements, Metal GPU kernels. - Standard library: files, paths, processes, time, random numbers, JSON, HTTP and HTTPS, TCP, UDP, TLS, WebSockets, channels, an event loop, a browser UI.
- C interop: headers imported directly, structs by value, varargs, callbacks, C sources in projects, Mimic functions exported to C.
- Toolchain: one
mimicbinary with Clang and LLD inside; native macOS and Linux; cross builds to musl Linux targets, WebAssembly (WASI) and Apple platforms;mimic test,fmt,doc,lldb,explain; JSON diagnostics. - CI: Linux x86_64 and macOS arm64 on every push; weekly benchmarks.
From CHANGELOG.md in the Mimic repository.