Shlemiel the Painter Is Back: How Zig’s libc Rewrite Made SQLite Slower

75 points by ohrv


squeek502

Relevant issue: https://codeberg.org/ziglang/zig/issues/37402

Pending PR: https://codeberg.org/ziglang/zig/pulls/37417

Student

That’s a lovely way of explaining quadratic time operations. I took a quick look at the linked zig code, and presumably it’s like this because it’s mapping c strings into nice safe zig arrays rather than treating them as unsafe streams of memory locations containing chars.

refi64

From one build and deploy script on my Mac I can target all of my platforms without containers or build machines. Zig’s elegant libzigc re-implements the standard library so you can static link the necessary functionality.

Zig uses musl (the standard library rewrite), but they have been rewriting it piece by piece in pure Zig (via libzigc), removing the C dependencies one at a time.

Hmm, was this using the musl triple when invoking zigbuild? I'd be a bit surprised if that didn't use musl, but I'm not sure what other libc values can be used in the triple other than glibc.

tobin_baker

Hate to say it, but LLM code review certainly would have caught such an obvious "accidentally quadratic" bug.