Anton Zhiyanov's Avatar

Anton Zhiyanov

@antonz.org

Open source maintainer at https://github.com/nalgeon. Author & educator at https://antonz.org

259
Followers
29
Following
104
Posts
07.02.2024
Joined
Posts Following

Latest posts by Anton Zhiyanov @antonz.org

Thank you for sharing, Laurent!

13.02.2026 11:14 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
(Un)portable defer in C Eight ways to implement defer in C.

How to implement "defer" keyword in C (allows to free memory and other resources correctly): implementations with C23/GCC, C11/GCC, GCC/Clang... - Blog Post by Anton Zhiyanov @antonz.org #Programming antonz.org/defer-in-c/

13.02.2026 08:05 ๐Ÿ‘ 6 ๐Ÿ” 3 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1
Preview
Allocators from C to Zig Exploring allocator design in C, C3, Hare, Odin, Rust, and Zig.

What makes modern systems languages stand out? Many things โ€” but allocators are a big one.

Let's explore how Rust, Zig, Odin, C3, and Hare design their allocators, and then build one in C!

antonz.org/allocators

12.02.2026 12:34 ๐Ÿ‘ 7 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Go 1.26 interactive tour New with expressions, type-safe error checking, and faster everything.

Go 1.26 is out, and the announcement says:

"Over the next few weeks, follow-up blog posts will cover some of the topics in more detail. Check back later."

So you can wait a few weeks OR you can read my interactive Go 1.26 tour right away:

antonz.org/go-1-26

11.02.2026 13:33 ๐Ÿ‘ 51 ๐Ÿ” 14 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Preview
Valkey: A new hash table Designing a state-of-the art hash table

SwissTable, a high-performance open-addressing hash map originally developed by Google, is becoming more popular in the industry.

First, Rust adopted it for its HashMap type. Then Go started using SwissTable for its map type.

And now โ€” Valkey. Pretty cool!

valkey.io/blog/new-has...

10.02.2026 16:17 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

Fancy an allocator in C? It's not Zig, but it's honest work.

08.02.2026 10:13 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
(Un)portable defer in C Eight ways to implement defer in C.

We don't need to wait for "defer" to be added to the C standard. We already have defer at home!

antonz.org/defer-in-c

05.02.2026 12:33 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

The only two features I really miss in C at this point are namespaces and defer.

04.02.2026 17:43 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

With Go 1.26, you can easily log to multiple targets (like stdout, a file, or a remote server) using just the standard library.

All thanks to slog.MultiHandler, which sends log records to any number of handlers you configure.

29.01.2026 14:56 ๐Ÿ‘ 33 ๐Ÿ” 5 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

When I first saw Go's interfaces, I was instantly sold. I didn't care that the language didn't have enums or generics โ€” Go's interfaces were love at first sight!

22.01.2026 16:18 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Interfaces and traits in C Implemented with structs and function pointers.

Who says we can't have nice things in C?

antonz.org/interfaces-i...

22.01.2026 12:21 ๐Ÿ‘ 3 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 1
Post image

With Go 1.26, you can peek into a byte buffer if you're that curious.

The new Buffer.Peek method in the "bytes" package returns the next N bytes from the buffer without advancing it.

The slice returned by Peek is not a copy; modifying it changes the buffer.

20.01.2026 11:33 ๐Ÿ‘ 5 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

I like how the Odin folks went, "Package management? Nah. Just copy and vendor them." ๐Ÿ˜ Brutal, but fair.

18.01.2026 07:28 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

I think it's the first time in Go's standard library that a number of public APIs have started behaving this way. It is justified, but still kind of sad.

14.01.2026 15:26 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Post image

Starting with version 1.26, most crypto APIs will simply ignore the reader parameter and use an internal system random source instead.

You can pass nil or a reader โ€” it doesn't matter anymore:

ecdsa.GenerateKey(elliptic.P256(), nil)

14.01.2026 15:25 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

These APIs don't guarantee how they use random bytes from the reader. Algorithm updates can change the sequence or amount of data read. So, applications that rely on specific behavior may break when the implementation changes.

The Go team chose a radical way to solve this problem.

14.01.2026 15:25 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

The most controversial change in Go 1.26 is probably the "reader-less" cryptography.

Current cryptographic APIs, like ecdsa.GenerateKey, often accept an io.Reader as the source of random data:

ecdsa.GenerateKey(elliptic.P256(), rand.Reader)

14.01.2026 15:25 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Based on the conversation, this one will probably get rejected too. I also don't think it's a good idea to add UUID string (!) generation methods to crypto/rand.

11.01.2026 15:57 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Very interesting, thank you! It's definitely hard to see all these nuances from the outside, being just a SIMD bystander.

11.01.2026 15:52 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Oh wow, another one :) I think I've seen several of these get rejected.

11.01.2026 15:42 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

The invention of the X-ray permanently changed medicine.

But was it wise to use X-rays for entertainment, shopping, and beauty treatments? Not really.

AI skepticism (not luddism) is the healthiest attitude for now.

11.01.2026 15:03 ๐Ÿ‘ 3 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Yeah, my bad. Thanks!

I was a bit confused because the author talks about finding transitive dependencies in the article (at the graph level, not in the source data), but then moves on to the final statistics without including them.

Well, it must be bcrypt then! Everyone loves bcrypt, right? :)

11.01.2026 14:18 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

They are probably transitive dependencies of other high-profile third-party packages like Gin.

11.01.2026 13:22 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Thanks :) I also tried building fake simd/amd64 and simd/arm64 myself. I like this setup better than having just one simd/archsimd package, but after trying both, I think either option works.

I'm definitely not a fan of the "package per vector size" approach ๐Ÿ˜…

11.01.2026 13:15 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Source: blog.thibaut-rousseau.com/blog/the-mos...

11.01.2026 12:44 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

So the second most imported 3rd-party dependency is Google's own UUID package. I wonder what it would take to convince the Go team to add it to stdlib.

Also, I don't think x/crypto and x/net should be here at all. Both are imported by stdlib itself, so they're basically included in every project.

11.01.2026 12:44 ๐Ÿ‘ 8 ๐Ÿ” 2 ๐Ÿ’ฌ 4 ๐Ÿ“Œ 0

Yes, this is more verbose than just having a single simd/archsimd with conditional logic in the client code to pick the right type.

But to me, this seems clearer and easier to maintain.

11.01.2026 12:04 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image Post image

My idea was to have simd/amd64 and simd/arm64 with distinct types, each package reflecting the CPU architecture (AVX/Neon) without even trying to be portable.

Then the user would create, for example, an Add function with two different implementations governed by build tags.

11.01.2026 12:02 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

The phrase "vector types will be defined on the architectures that support them" is what I'm talking about.

I interpret it as "some archsimd types will be available on amd64 and some on arm64."

In my opinion, this is less clear than having separate packages with partly overlapping type sets.

10.01.2026 20:36 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Post image

Yes, the methods map to AVX instructions very closely.

09.01.2026 17:47 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0