Skip to content

Performance improvements and upgrade to Zig 0.16#4

Open
lvignoli wants to merge 26 commits into
mainfrom
lv/upgrade
Open

Performance improvements and upgrade to Zig 0.16#4
lvignoli wants to merge 26 commits into
mainfrom
lv/upgrade

Conversation

@lvignoli
Copy link
Copy Markdown
Collaborator

@lvignoli lvignoli commented May 11, 2026

This MR contains several performance improvements, mostly by reducing the generous use of allocations found in the former version.
Using crap, I observe a 9-fold improvement in runtime on my machine for the simple and dummy bench.zig benchmark that encodes a thousands UUID in a row with default settings.
Capture d’écran 2026-05-14 à 10 21 01

I took the breaking change opportunity to upgrade to Zig 0.16, so I am tagging a new version.

lvignoli and others added 18 commits August 25, 2025 14:53
This saves allocation of a new buffer just for the current number encoding.
We know we'll have less than 128 characters in the alphabet. It is an overestimation, as
some ASCII characters are not printable and will probably never been used in an
alphabet.

Also fixes the previous wrong 256 value here and there.
Thanks a lot Karl Seguin.
BREAKING CHANGE: Sqid struct is now unmanaged. Sqid.init takes no
allocator. Calls to encode and decode take an allocator.
init suggests that it must be deinit afterwards. Since Sqid is now an
unmanaged struct, there is no deinit.

A constructor is still required for validation of the options
arguments, I call it new.
Prefer a plain list of words, and let the user handle optimizations.
@lvignoli lvignoli self-assigned this May 11, 2026
@lvignoli lvignoli requested a review from 4kimov May 14, 2026 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant