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.

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:

perf benchmark screenshot

This line of code tickles me:

state: switch (State.start) {