Live data from Hacker News

Zig is now self–hosted by default

github.com

101–110 of 115 posts

Re: Zig is now self–hosted by default

#101
post #58

Earlier quoted context omitted.

That one hasn't been updated in a while, but this one is under active development: https://plugins.jetbrains.com/plugin/18062-zig-support

I saw that one as well, but there are hardly any features. I'm mostly looking for "go to declaration/definition", "find usages" and others which turn codebase into basically a browsable hypertext.

Warning: Pure speculation ahead.

Based on this issue [1] I have a feeling JetBrains is keeping their eye on Zig for an official plugin.

Zig + high powered IDE support would be magical.

[1] https://youtrack.jetbrains.com/issue/FL-10463

Re: Zig is now self–hosted by default

#102

To clarify what this means, since things can get confusing with subtle differences in wordings: * stage1 is when zig is built from C++ code[1] (the "bootstrap" compiler) using system C/C++ compiler toolchain. * stage2 is when zig is built from Zig code[2] using stage1. * stage3 is when zig is rebuilt from the same Zig code[2] using stage2. Before today, zig would give you stage1 by default, and you could opt in to st…

> Zig produces smaller, faster binaries than C++ This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++

A smaller binary will not necessarily be faster - specialization can bloat code size, but having a specific version for a given subtype can be much faster. It’s a tradeoff.

Re: Zig is now self–hosted by default

#103

Earlier quoted context omitted.

> Case in point: the new self-hosted compiler is 1.5x faster than the C++ implementation and uses 3x less peak RAM. I am not sure it is comparable: the self-hosted compiler uses a different architecture [1]. [1] https://vimeo.com/649009599/7f1fda43ff

This is true, but I don't think your point entirely fair either. Zig's design lends itself to writing this style of code. In contrast the usual way(s) C++ is used encourages code that makes these types of optimizations hard/impossible. In practical terms, if you wanted to write fast software, the ergonomics of the language allowing you to use the desired architecture matter a lot. (Also, you're replying to the primar…

While ergonomics matter, I don’t believe the question is settled at all - for very high performance applications C++ is the answer for a long time to come.

Re: Zig is now self–hosted by default

#104

To clarify what this means, since things can get confusing with subtle differences in wordings: * stage1 is when zig is built from C++ code[1] (the "bootstrap" compiler) using system C/C++ compiler toolchain. * stage2 is when zig is built from Zig code[2] using stage1. * stage3 is when zig is rebuilt from the same Zig code[2] using stage2. Before today, zig would give you stage1 by default, and you could opt in to st…

> Zig produces smaller, faster binaries than C++ This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++

right after that sentence there's a link to a talk that explains one way this is true

Re: Zig is now self–hosted by default

#105

To clarify what this means, since things can get confusing with subtle differences in wordings: * stage1 is when zig is built from C++ code[1] (the "bootstrap" compiler) using system C/C++ compiler toolchain. * stage2 is when zig is built from Zig code[2] using stage1. * stage3 is when zig is rebuilt from the same Zig code[2] using stage2. Before today, zig would give you stage1 by default, and you could opt in to st…

> Zig produces smaller, faster binaries than C++ This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++

Because they can't do breaking changes and must live with legacy baggage.

While zig can work use modern techniques without such issues

Re: Zig is now self–hosted by default

#106

Earlier quoted context omitted.

> Zig produces smaller, faster binaries than C++ This seems fairly significant to me and makes me wonder how this is possible with all the effort that has gone into optimizing C++

right after that sentence there's a link to a talk that explains one way this is true

We can hardly be expected to watch a 46 minute video on "A Practical Guide to Applying Data-Oriented Design" to find our answer. It seems unpromising on the surface.

Re: Zig is now self–hosted by default

#107

Earlier quoted context omitted.

right after that sentence there's a link to a talk that explains one way this is true

We can hardly be expected to watch a 46 minute video on "A Practical Guide to Applying Data-Oriented Design" to find our answer. It seems unpromising on the surface.

Data oriented design is why the thing is faster.

Re: Zig is now self–hosted by default

#108

Earlier quoted context omitted.

We can hardly be expected to watch a 46 minute video on "A Practical Guide to Applying Data-Oriented Design" to find our answer. It seems unpromising on the surface.

Data oriented design is why the thing is faster.

I guess I'll wait for the benchmarks comparing C++ and Zig over a variety of problem solutions to see which one is faster

Re: Zig is now self–hosted by default

#109
post #91
post #71

Earlier quoted context omitted.

C is a wretchedly bad language for writing compilers.

Indeed, however since that is what many see, plenty of which place the genesis of high level languages on the birth of UNIX, the myth persists.

The fact that constant-folding is hard because the C language doesn't have portable semantics for basic things like integer addition (with overflow) is just braindead.

Re: Zig is now self–hosted by default

#110
post #109
post #91

Earlier quoted context omitted.

Indeed, however since that is what many see, plenty of which place the genesis of high level languages on the birth of UNIX, the myth persists.

The fact that constant-folding is hard because the C language doesn't have portable semantics for basic things like integer addition (with overflow) is just braindead.

Yes, there are lots of optimizations that are hard in C and only possible thanks to UB abuse.
Post reply on HN