Skip to content

zig binarytrees: use ArenaAllocator #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Nathan-Franck
Copy link

Using an arena allocator, as mentioned in #408 - gives me a 3x speed increase

@bmaxa
Copy link
Contributor

bmaxa commented Sep 2, 2023

arena allocator is forbbiden, happened to me in first version od Odin binarytrees, I have to correct
to heap allocator.

@ivanstepanovftw
Copy link

@bmaxa

arena allocator is forbbiden

But why?

@evaporei
Copy link

evaporei commented Apr 25, 2025

Allocators and arenas are literally what makes languages like Odin and Zig shine in performance. Not being able to use them makes their benchmarks completely useless. In fact, it only spreads misinformation, showing they're slower than they can be.

@Nathan-Franck
Copy link
Author

Allocators and arenas are literally what makes languages like Odin and Zig shine in performance. Not being able to use them makes their benchmarks completely useless. In fact, it only spreads misinformation, showing they're slower than they can be.

It's true. Why would arenas be forbidden but Garbage Collection is fine for Java, and Rust is allowed to use an external crate for compile time reference counting? Makes no sense to me. I use Arena allocators all the time in my zig code now, and it's amazing. It has freed up so much CPU time to do other more important things besides lifecycle tracking, that I'm almost spoiled for compute. If you are reading this, please reconsider letting us use arenas in the benchmarks! It's in the standard library for a reason!

@ivanstepanovftw
Copy link

ivanstepanovftw commented Jun 30, 2025

Currently, Li Zhihong in his Zig solution is benchmarking both libc allocator and system calls. This affects users decisions in their programming language choice. For 2 years.

@ivanstepanovftw
Copy link

ivanstepanovftw commented Jun 30, 2025

Why would arenas be forbidden but Garbage Collection is fine for Java

Literally this. If arena allocator is disallowed, why don't you call garbage collector on every iteration in C#, Java, Kotlin, Go?

Why do you keep solutions of C# and Go if it is known that they use arena allocator under the hood?

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.

4 participants