<mikdusan1>
re building with 6GB of ram; comparing two 'zig0' ... one (and it's llvm deps) built with Release vs MinSizeRel. I didn't expect it to impact max-RSS but on macos:
<mikdusan1>
7142372 KB vs 6167180 KB, respectively
<mikdusan1>
and watching Activity Monitor.app, "memory" maxes out at 5.98 GiB vs 5.44 GiB, respectively
<mikdusan1>
but big penalty in performance. 51 seconds vs over 3 minutes
<mikdusan1>
is it enough to help? doubt it.
lunamn has quit [Read error: Connection reset by peer]
ave_ has quit [Remote host closed the connection]
linuxgemini has quit [Read error: Connection reset by peer]
nvmd has quit [Quit: Later nerds.]
Swahili has quit []
<v0idify>
mikdusan1, did you send another message?
<andrewrk>
if you scroll through some of the comments there are a few benchmarks
<v0idify>
ooh benchmarks
<andrewrk>
I'm about to have some fun doing a silly benchmark of 1 million print() calls :)
<v0idify>
fun fun fun
<andrewrk>
20,390 lines added, −17,148 lines deleted, and it took all of 30 minutes to debug the 4 regressions in the stage2 test cases
<andrewrk>
this is the magic of zig
<v0idify>
the secret sauce
<v0idify>
why does compiling stage2 have a -Denable-llvm flags? is it using llvm for some parts right now?
<v0idify>
i actually got it to compile but only without the flag and it can't compile anything
<andrewrk>
have a look in the test/stage2/ directory for some examples of test cases that are supported by stage2. it's not a large percent of language features
<v0idify>
well I meant that it literally would fail instantly with "no entry point found"
<andrewrk>
in answer to your other question, stage2 currently has the following backends, to varying degrees of completeness: aarch64, arm, x86_64, LLVM, C, riscv64, spirv, spu-mk2, wasm
<andrewrk>
the LLVM one requires -Denable-llvm
<v0idify>
how can i get it working with any backend? i assume it didn't work because it didn't have any backend?
<v0idify>
any backend as in, i just want to see it compile, ideally something i can run on my machine, without llvm
<andrewrk>
the behavior you are observing is it working properly, however it does not support start.zig yet, so you have to export your own _start function
<v0idify>
ahh that makes sense. can I just manually import start.zig?
<v0idify>
or i guess it uses language features it doesn't work with yet
<andrewrk>
no because stage2 is not capable of handling it yet
<v0idify>
got it
<andrewrk>
you may be interested in playing with the C backend. try passing: -ofmt=c
ky0ko has quit [Remote host closed the connection]
marler8997 has joined #zig
<v0idify>
how can i make zig fmt put if statements with many and/or in multiple lines?
<marler8997>
huh, Zig has nameless tests now?
<g-w1>
yep, for module wide stuff
earnestly has quit [Ping timeout: 240 seconds]
<marler8997>
g-w1, I got ziget to work with schannel by the way
<marler8997>
having troubles using it with zigup at the moment because "zig build" is trying to create a symlink for some reason
<andrewrk>
marler8997, nameless tests are never filtered out with --test-filter, so they can be used to import other files and have --test-filter work when using zig test to discover the entire source tree
<andrewrk>
v0idify, put a newline after the )
<andrewrk>
v0idify, oh you mean there are `and` and `or` clauses? you can put a newline after any infix operator such as `and` and `or`
<marler8997>
andrewrk, is it easy to update the windows Zig+llvm+clang binaries? they don't build since the nameless tests were added
<andrewrk>
yeah sure I'll take care of that tomorrow. in the meantime the wiki lists a workaround
<marler8997>
I've been spoiled by this awesome all-in-one sdk, I never want to go back to msvc
<andrewrk>
I'm doing everybody's favorite benchmark, printing hello world 1 million times xD
<v0idify>
I mean it's what developers will first try! it has to be as fast as possible
<andrewrk>
ha! this branch takes us from 1.2s to 0.9s
<v0idify>
that's actually quicker than i thought
<v0idify>
what std thing is a precise timer for benchmarking?
<mikdusan2>
speaking of building the Windows Zig Compiler Dev Kit, here's a repo that apparently (haven't tried it yet) walks one through building on non-windows host against
<mikdusan2>
copied windows SDK headers and Visual Studio headers:
<marler8997>
that's over 4 times bigger than the standard library!
<g-w1>
marler8997 just looked at some of the files in api, you can replace test "" { with test {
<marler8997>
sure I'll do that
<marler8997>
done
proteusguy has quit [Remote host closed the connection]
osa1 has joined #zig
cole-h has quit [Ping timeout: 240 seconds]
<andrewrk>
marler8997, not yet - this is stage2 so the next step before we can test that is to make stage2 support more language features
craigo_ has joined #zig
xackus_ has joined #zig
swills has quit [Ping timeout: 240 seconds]
xackus has quit [Ping timeout: 240 seconds]
swills has joined #zig
zags has joined #zig
cole-h has joined #zig
swills has quit [Ping timeout: 240 seconds]
swills has joined #zig
swills has quit [Ping timeout: 246 seconds]
swills has joined #zig
swills has quit [Ping timeout: 246 seconds]
swills has joined #zig
jokoon has joined #zig
swills has quit [Ping timeout: 240 seconds]
earnestly has joined #zig
jjido has joined #zig
hnOsmium0001 has quit [Quit: Connection closed for inactivity]
swills has joined #zig
proteusguy has joined #zig
sord937 has joined #zig
geemili has quit [Ping timeout: 260 seconds]
sord937 has quit [Quit: sord937]
zags has quit [Quit: leaving]
lunamn has joined #zig
ave_ has joined #zig
linuxgemini has joined #zig
jokoon has quit [Read error: Connection reset by peer]
<Cadey>
andrewrk: oh my god that's incredible
<ikskuh>
marler8997: wow, that's one big chungus
wootehfoot has joined #zig
<ifreund>
that's the only person I have blocked on the zig discord so far...
<ikskuh>
i am not allowed to block :D
eax has joined #zig
eax has quit [Remote host closed the connection]
eax has joined #zig
eax has quit [Remote host closed the connection]
eax has joined #zig
Thale20 has joined #zig
wootehfoot has quit [Read error: Connection reset by peer]
<Thale20>
Hello everyone,
<Thale20>
I started writing some software with zig, but there are some pretty fundamental things I can't really figure out with the documentation of the std library.
<Thale20>
Not sure if this is a good place to ask questions?
<ifreund>
this is a fine place to ask questions
<ifreund>
note that the autogenerated std docs are very incomplete, it's better to just read the source code
<Thale20>
Yes, I had that feeling. I think most of these would be answered easily by seing some example code too. I know the tetris example, but it is very small,
<Thale20>
so I was wondering if there is some bigger zig code base that you could recommend having a look at?
<ifreund>
well, the standard library qualifies I think :P
<ifreund>
ziglings might be a nice way to get started
jjido has quit [Quit: Connection closed for inactivity]
josias has joined #zig
vktec has quit [Quit: WeeChat 3.0.1]
klltkr has joined #zig
Snaffu has joined #zig
m4r35n357 has joined #zig
<marler8997>
ikskuh yeah the Win32 api is massive
<marler8997>
andrewrk I was thinking to test tokenization/parsing perf
<marler8997>
it is an odd use case because it's only declarations, no actual Zig code in there
<ikskuh>
heh
<ikskuh>
i wonder how well "zig fmt" will work
<marler8997>
My build.zig file for zigup requires that the user select an ssl backend, but that makes "zig build -h" not work without a backend selected
<marler8997>
I could check whether or not the "help" is being enabled, if that's available, does this sound correct?
<ikskuh>
marler8997: why does "zig build" require ssl?
<marler8997>
it requires the user to select an ssl backend they want to build with
<ikskuh>
yeah, so?
<ikskuh>
if none is selected, error out
<marler8997>
I'm now adding a new target that doesn't require an ssl backend
<ikskuh>
it will allow "zig build --help"
a_chou has joined #zig
<marler8997>
zig build --help doesn't work unless an ssl backend is selected now, which is not what I want
<marler8997>
zig build -h should work whether or not they've specified a backend
<marler8997>
is there a way to add a callback to a target just before it builds?
<marler8997>
I could run the check in there
<marler8997>
wait, maybe I can make these exe steps depend on a check step?
<marler8997>
ooo I think I'm on to something
<ifreund>
yeah custom steps are the only way to add lazy actions
<marler8997>
yeah this is what I needed
m4r35n357 has quit [Quit: Ex-Chat]
xackus has joined #zig
xackus_ has quit [Ping timeout: 264 seconds]
<marler8997>
I'm adding a step in my build.zig to build binaries for multiple platforms, I'm a bit confused in outputdir vs installdir
<marler8997>
is output_dir supposed to be a relative dir to install prefix?
<marler8997>
oh I see dest_dir, maybe that's what I want
<ifreund>
what's your goal?
<marler8997>
my build.zig file is building a bunch of variants of the same exe
<marler8997>
for the purposes of uploadeing to github
<ifreund>
ok, and you want to put them somewhere without overwriting each other?
<marler8997>
yes
<ifreund>
dest_dir only exists to handle the DEST_DIR environment variable often used for distro packaging
<ifreund>
output dir is relative to the install prefix afaik, as you said
<marler8997>
is output dir supposed to be for build or install?
<marler8997>
I see .o files in it, so it seems like it's for build, but if it's relative to install prefix, then it's for install, hence the confusion
<marler8997>
is it for both?
<ifreund>
for build
<marler8997>
ok great, that answers one question
<marler8997>
in that case, it doesn't have anything to do with install prefix right?
<ifreund>
yeah your're right, sorry this stuff is a bit of a mess
<ifreund>
out_dir is set whatever cache directory in zig-cache the zig compiler invocation returns
<marler8997>
ok that make sense with everything else
<ifreund>
I don't think std/build.zig supports installing to multiple prefixes with a single invocation
<marler8997>
that's fine
<marler8997>
the goal is simple here, just build a bunch of exe variants
<ifreund>
simplest way is probably to just give each a different name tbh
<ifreund>
marler8997: oh, I think I actually implemented something that will do what you want, see LibExeObjStep.override_dest_dir
<ifreund>
set that to something different for each of your binaries
<marler8997>
I'm still confused about output_dir
<marler8997>
it doesn't go into zig-cache
<marler8997>
it looks like it goes into cwd?
<g-w1>
marler8997, do you think it would be a good idea to setup a github actions to automatically compile the latest zigup and package it in github releases? I can do that if you want?
<ifreund>
marler8997: output dir won't be set until the objects are built...
<marler8997>
maybe but I still want to build the binaries with build.zig
<g-w1>
yeah, once you have this, it would be easy to make a github action to package it i think
<marler8997>
ok, so I've confirmed setOutputDir is relative to CWD
<marler8997>
but I'm confused why it puts .o files in there? wouldn't those go into the cache, not the output dir?
<marler8997>
I'm still unclear what Zig thinks the output dir is for, and/or the install prefix for that matter at this point
Thalheim has joined #zig
<marler8997>
where does alexnask hang out? Is he here on irc or dicord?
xackus_ has joined #zig
<g-w1>
sometimes here, sometimes discord, sometimes neither
<ifreund>
marler8997: the output dir is where the output of zig compiler invocations go. The install dir is where these artifacts will be copied to when you do zig build install
<marler8997>
I thought zig would put the output of compiler invocations in the cache
<ifreund>
it does unless you tell it to do otherwise by setting out_dir
<marler8997>
ah I see
<ifreund>
and when it puts them in the cache it sets out_dir to whatever specific cache path was used
xackus has quit [Ping timeout: 264 seconds]
<marler8997>
not the exe though, which is what is causing the problem
<marler8997>
when using cache, .o files and exe files are handled different
<marler8997>
when using outputdir, they are handled the same
Akuli has joined #zig
<marler8997>
might be unnecessary complexity, not sure
<marler8997>
in any case, I think setOutputDir will work, thanks for the help
<ifreund>
no problem
<ifreund>
I think the zig build system could really use a teardown and rewrite once the language is more stable tbh
<ifreund>
it's quite crufty
<marler8997>
yeah, it's fundamental design and features are really good. There are however some oddities that can be improved
<ifreund>
agreed
<marler8997>
enum value to string?
<marler8997>
comptime string
<marler8997>
ah @tagName
bitmapper has quit [Quit: Connection closed for inactivity]
<marler8997>
I think I'll have to wait to get iguana working before releasing static prebuilt binaries of zigup, depending on openssl and trying to make that work on all distributions is going to require some "reloader" magic that I don't feel like dealing with
a_chou has quit [Remote host closed the connection]
<Thale20>
What is the easiest way to read a given number of bytes from a file into a memory adress? Somehow I really struggle with the concept of slices here.
<ifreund>
doesn't ikskuh have BearSSL bindings that you could use to build statically?
<Thale20>
Like essentially I want to do sth like this:
<g-w1>
what advantages does bearssl have over iguanatls?
<ifreund>
it's a lot more mature for one
Snaffu has quit [Quit: leaving]
gpanders has quit [Remote host closed the connection]
gpanders has joined #zig
tomku has quit [Quit: Lost terminal]
<andrewrk>
maturity is extra important when using a library where security is a primary feature
<earnestly>
openssl is that
<earnestly>
Or is it so mature that it has gone moldy? :p
tomku has joined #zig
tomku has quit [Quit: Lost terminal]
<marler8997>
ikskuh I think there's a bug in your zig-bearssl, I think write cannot return 0, it creates an infinite loop in std.io.Writer.writeAll
<marler8997>
it looks like bearssl might have a "br_sslio_write_all" function for this purpose
<marler8997>
oh no that's not what supposed to be called, but returning 0 does cause an infinite loop
<marler8997>
I think Writer is expecting write not to return 0 ever...not sure
emptee has joined #zig
tomku has joined #zig
tomku has quit [Client Quit]
emptee_ has joined #zig
emptee has quit [Ping timeout: 272 seconds]
<emptee_>
Is there a way to bundle all tests under a single test suite? So that several "All N tests passed" are aggregated into a single line? Currently I am adding tests in a for loop to the "test" target.
<ikskuh>
emptee_: not really, tests are just different executables run
<ikskuh>
marler8997: happy to accept PRs
<emptee_>
Ok, thanks. It is not really a big deal, it is just sightly annoying me for some reason.
tomku has joined #zig
klltkr has quit [Ping timeout: 256 seconds]
tomku has quit [Quit: Lost terminal]
tomku has joined #zig
<marler8997>
stil not sure it's actually a bug though, was wondering if anyone knew more
<marler8997>
like, maybe it's a bug in writeAll?
klltkr has joined #zig
<ifreund>
marler8997: write should never return 0 on posix conformant systems
<ifreund>
if no bytes have been written before the write is interruped, EINTR should be set as errno and -1 returned
DarkUranium has quit [Remote host closed the connection]
<g-w1>
maybe? im using nix so idk
<g-w1>
why would that matter?
DarkUranium has joined #zig
DarkUranium has quit [Remote host closed the connection]
<g-w1>
it seems to be using gcc
<g-w1>
9.3
<ifreund_>
g-w1: compiler warnings aren’t stable. Usually if new warnings seem to appear out of nowhere it’s because you are using a newer, smarter compiler