Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In what industries is Zig popular? I'm asking as I saw Zig as being the 'highest' paid language on the 2023 Stack Overflow Dev survey - https://survey.stackoverflow.co/2023/#section-salary-salary-...

The performance looks outstanding!



My company uses Zig to write software for small Linux devices, such as set-top boxes.

The biggest benefit isn't exactly performance, but the absurdly tiny binaries it produces (very convenient if you are working with small flash disks!), and how the Zig standard library doesn't depend on anything other than the kernel, which means you can often entirely ignore all library issues; more often than not our software 'just works' when built for some new customer platform even though I've never even targeted that environment (or even CPU architecture) before.


If you don’t mind me asking, how long has your company been using Zig in production?


We first finished a Zig application three years ago, but that was a fairly small demo project which we didn't have to support afterwards.


Zig is very popular for WebAssembly: https://wasm4.org/blog/jam-2-results/


It's still pretty early on, but it's aim is to be a C successor I believe. Main example of usage off the top of my head is for bun.sh


how is that different from rust? or is rust a cpp successor?


Rust lives in the smart pointer world. So a good candidate as a c++ succesor. Zig lives in arena alloc and soa world. So it's a better than rust when you need performance beyond the norm.


Just to be clear, you can absolutely do arena allocation and soa in Rust.


In Rust you have convenient escape hatch with a default allocator. It's similar to say "you can do safe applications using C or C++".


Rust is more of a c++ successor, yes.

It’s very much a kitchen sink language.


Zig is still rather new, but it would be a good alternative to C, C++, Rust and Go.


Zig is mostly a good alternative to C.

If Rust or C++ are possible options, Zig probably isn't what you really want. Rust is especially good if you can keep everything in Rust and make the most of the ecosystem.

I like Zig, but it is a much smaller language that C++ or Rust with more than a few very, very sharp edges. That having been said, I reach for Zig in a lot more instances than I thought I would. I write a lot of relatively small programs that I want to work on Linux/Windows/macOS, and Zig is pretty good at that.

Of course, I miss Rust terribly every time I run a Zig program and get a segfault.


Can Zig also be used to compile static libraries for iOS and Android?


There's no good reason why not. Zig is, after all, a full C compiler so it can certainly create C libraries.

You can create a full Zig program to run on Android: https://archive.fosdem.org/2021/schedule/event/zig_android/

iOS: https://www.jakubkonka.com/2022/04/30/ios-dx-with-zig-milan-...


The first three, but not Go.


Depends on your use cases. The reason I love Go are:

- Simplicity and readability

- Batteries included: projects don't have to depend on too many 3rd party dependencies

- Same code can be easily compiled to many different architectures

- Fast compile time

- Large ecosystem

With the exception of the large ecosystem, Zig offers a similar experience.


Why not Go? Not very comparable due to GC and goroutines?


Right. The others are system languages you could write a kernel or a game engine in.


I'm going to be pedantic here, but this merely means that Go can't fill Zig's niche.

Zig can (in a lot of situations) presumably easily fill Go's role. Both languages have a focus on simplicity and explicit syntax.

In other words, Zig is in fact a decent alternative to Go. Go just isn't a good alternative to Zig.


Zig isn't memory-safe, and you're not going to pay for the development overhead of manual memory management if you're doing regular back-end stuff.


People did for decades and a lot of that "regular back-end stuff" is in C++ at the moment. If you wanted to move it to a different language, you might currently choose to move it bit-by-bit to Go. But you could also move it bit-by-bit to Zig, and it wouldn't be an unreasonable choice. Zig is in that sense an alternative to Go, IMO.


> People did for decades

Yes, but it was before the invention of mobile phone… Since Java came out, the majority of back-end has been written in memory-safe language, for good reasons.

> you might currently choose to move it bit-by-bit to Go

Not even Google, the home of Go, has been doing a C++ to Go conversion. Backend services that are still in C++ in 2023 are probably so for good reasons, most likely because they either have:

1. really high performance requirements, hence no Go.

2. low budget, and are mostly maintained as it is, hence no rewrite.

In any case, those are only a fraction of the total backend code, which is mostly PHP, Java, and Nodejs.


AFAICT you could technically use a GC'd language for either, perhaps just not best suited for it.

On the other hand, Zig can fill the niche Go does, but again, probably not best suited for it.

I guess I'm just being pedantic here :).


If you really want to be pedantic, Zig could maybe be considered a GC’d lang, if you count selecting a GC for as it’s allocator (presumably with some ugly(?) comptime assurances) ;-)


There are production examples of both, written in Go.

Besides, is writing compilers and linkers, systems programming?


I was wondering this exact thing! Who's out there getting paid to write Zig?


The core Zig devs, TigerBeetle and Bun are the main ones AFAIK. The latter two are VC backed, the Zig Software Foundation is a 501(c)(3).


> the performance looks outstanding!

Well, given that in their benchmark Go ends up Boeing almost an order of magnitude raster than Rust, I wouldn't trust their benchmarking methodology too much.


Wasn't Uber using Zig? At least for it's cross-compiler features, if I recall properly.





Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: