4 ms·
> [Compiling] takes about ~3 seconds minimum which is frustratingly slow I feel old, I know that any time is an opportunity to get distracted but 3 seconds doe
by eterm 5y ago
> [Compiling] takes about ~3 seconds minimum which is frustratingly slow
I feel old, I know that any time is an opportunity to get distracted but 3 seconds doesn't strike me as a long compile time.
Or is that a typo for 30, which would make more sense, which is definitely long enough to be a frustration?
- delphLonepaw 5y agoDepends on the machine, on large projects, zig can take up to 10-15 seconds in my i5 12gb, ofc, after the first hit it becomes 0.01 recompiling without change (in case you removed the out and not the cache) and the first time you compile it takes a bit (not counted) since it will precompile std (or that is what I've seen) in a global cache (just so std does not make your code take longer to compile), small things takes 1-3 seconds depending on how comptime heavy I make my code do. Zig comptime is the part that takes a bit more time compiling for being an interpreted version of the language, and the more comptime you use, the more time it takes (for a bit, even comptime heavy code can gain just a few seconds out of it, of course can gain 30 minutes, but you would be making like, weird jumps and generating strings on comptime that gets used on runtime, or an expensive algorithm that will take a long time to execute)
- ralphb 5y agoThat's funny. I am old, and I think 3 seconds is unacceptable. I use zig anyway.
- llimllib 5y agoThat complaint was weird, here's my day 7 solution in zig built in release mode: $ time zig build-exe ./a.zig -O ReleaseSmall real 0m1.728s user 0m1.544s sys 0m0.292s Which is actually slower than running the entire solution in debug mode: $ time zig run a.zig -- input.txt min 337 342641 min 470 93006301 real 0m1.138s user 0m0.789s sys 0m0.270s Totally possible that it's much slower on the dev's machine, but if he's a VR developer it seems weird that he'd have a low-powered box. [1]: https://github.com/llimllib/personal_code/blob/master/misc/advent/2021/07/a.zig https://github.com/llimllib/personal_code/blob/master/misc/a...
- forrestthewoods 5y agoBlog author here. I'm an Intel i7-8700k desktop. A few years old at this point, but quite beefy. Maybe this is a Windows issue? If I run "zig build" and then immediately run "zig build" again it still takes 3 seconds.
- llimllib 5y agoTotally possible! I don't have a Windows box to test on, and win does sometimes end up as a second class citizen for stuff like this.
- mst 5y agoA relatively quick way to test that theory might be to pull down a WSL2 image of some sort and run the same thing in there. Speaking as somebody who mostly codes for *n?x but has some windows users of their libraries, I've run face first into "everything I know about build optimisation is inapplicable on windows" more than once. ('everything' is admittedly slightly hyperbolic but I'm sufficiently bad at windows tooling that it always feels that way)
- defen 5y agoSounds like something is messed up with your zig cache. I have a medium-size project (30 files, 10s of thousands of lines of code) that takes 0.07 seconds to `zig build` if nothing has changed. This is on a Mac.
- forrestthewoods 5y agoHow do I clean the zig cache? There does not appear to be a "zig clean".
- anonymoushn 5y agorm -rf zig-cache over here
- 5y ago
- Accacin 5y agoI read it differently to you. I don't think he meant three seconds is long for compiling in general, but when you are unfamiliar with the code and trying to make it work, having to wait three seconds everytime you make a small change adds up to become annoying. I think that's why he would like a `zig check` command that would give him these errors and warnings faster.
- gameswithgo 5y agowhen you don’t have in editor compiler errors and are trying to learn instant feedback can be nice
- delphLonepaw 5y agofun stuff, zig syntax error stuff is handled both by zls and zig fmt --ast-check (or if you care only for one file) zig ast-check =) For compile errors I think zig build is the only way
- AnIdiotOnTheNet 5y agoHonestly I'm surprised it takes 3 whole seconds. Unless I'm importing zigwin32 I don't think I've ever had a Zig project take that long to build. But then again, I avoid linking to C at pretty much any cost, maybe OP didn't.