Devlog
This page contains a curated list of recent changes to main branch Zig.
Also available as an RSS feed.
This page contains entries from the current year. Previous years are available in the Devlog archive page.
CI Coverage Added for Incremental Compilation
Author: Matthew Lugg
Over the last few months, myself and Jakub have been working hard on incremental compilation, where the compiler can "remember" parts of a previous build and only re-compile the code that changed. We just hit an important milestone here: our CI test suite now includes our "incremental compilation" tests! This set of tests is small right now, but will grow rapidly as we fix bugs and, eventually, fuzz test the implementation.
You can find all our incremental compilation test cases here. The CI runs all of them on x86_64-linux
with the self-hosted x86_64 backend, as well as on a few targets with the C backend (-ofmt=c
). It's approaching the point where you can start to use incremental compilation in some very basic cases; for instance, I've recently managed to perform an incremental update on Andrew's Tetris clone.
If you're using a master
build of Zig on Linux on x86_64, you can try playing with incremental compilation right now with this command:
zig build -fincremental --watch
(Make sure your Step.Compile
has .use_llvm = false, .use_lld = false
, so Zig doesn't try to use LLVM!)
Beware, though, that you'll run into bugs pretty quickly, including false positive compile errors and even miscompilations; use at your own risk.
New Devlog Structure
Author: Loris Cro
The devlog has switched to a per-year pre-sharded structure to avoid the issue of having a page that grows indefinitely.
NOTE: the RSS feed link has not changed. No action needed from RSS feed consumers. Cached links to older entries might become stale, but new entries from now on will have the correct link.
If you want to get a similar setup going for your personal blog, check out https://github.com/kristoff-it/zine-devlog-examples
loongarch64 added to the download page
Author: Andrew Kelley
Thanks to contributions from YANG Xudong and Alex Rønne Petersen, along with upgrading to LLVM 19, loongarch64 support in Zig is progressed enough that zig-bootstrap works for this target. In celebration, I have added loongarch64-linux to the download page.
2024-09-16
Author: Andrew Kelley
I've been porting stb_truetype.h to Zig on the side. Check out this snippet:
{
float sum = 0;
for (i=0; i < result->w; ++i) {
float k;
int m;
sum += scanline2[i];
k = scanline[i] + sum;
k = (float) STBTT_fabs(k)*255 + 0.5f;
m = (int) k;
if (m > 255) m = 255;
result->pixels[j*result->stride + i] = (unsigned char) m;
}
}
⬇️
{
var sum: f32 = 0;
for (scanline, scanline2, result.pixels[j*result.stride..][0..result.w]) |s, s2, *p| {
sum += s2;
p.* = @min(@abs(s + sum)*255 + 0.5, 255);
}
}
Ahh, much better.
Zig tokenizer updated to use labeled switch statements
Author: Andrew Kelley
Now that Matthew landed labeled switch continue syntax, it's time to start using it.
Eric Petersen swooped in for a first-time contribution, updating Zig's tokenizer to use the new syntax, measuring a 13% wall time performance increase for the zig ast-check
command:
This line of code tickles me:
state: switch (State.start) {