Elektrine lite

← Feed

@nicolaasuni@mastodon.social

2026-08-02 11:00 UTC

About 2 ns to hex-encode a uint64: that is what knowing the width at compile time buys. Precompute 256 packed uint16 pairs, unroll, and hand the encoder a pointer to a fixed array so the compiler drops the bounds checks. The uhex package in nurago derives it step by step; when the result heap-allocates anyway the advantage mostly evaporates. https://tecnick.com/articles/nurago-uhex/ #golang #performance

Replies (0)

No replies.