ChanServ changed the topic of #zig to: zig programming language | ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
cantsin has quit [Remote host closed the connection]
mnoronha has joined #zig
nodist has joined #zig
nodist has quit [Quit: Leaving]
redj has quit [*.net *.split]
dpk has quit [*.net *.split]
dpk has joined #zig
<scientes>
is there a way to tell if you are running in a co-routine, or on the main thread?
<andrewrk>
in order to prevent optimizations from ruining your benchmark, you have to output the data that you calculated
<andrewrk>
doing a volatile store of data is a form of output though
<wink_>
Not sure what you mean by "you have to output the data that you calculated" but volatile does remove some optimizations, because if I use constants the add operatoin will be, correctly hoisted outside the loop, where as using volatile I see loads and stores.
<wink_>
I found that I need to look at the assmebly output so I can see what's actually being measured.
<andrewrk>
volatile makes loads and stores considered to have side effects, but that's all it does
<andrewrk>
the optimizer is free to do anything as long as all the volatile operations are preserved and in the same order
kristate has joined #zig
SimonNa has quit [Read error: Connection reset by peer]
SimonN has joined #zig
<wink_>
yep, which is why I looked at the assembly output to verify the loads and stores were inside the loop. Of course the loop has been unwound to 8 times and the upper 64 bits of the r: u128 isn't stored until after the loop :)
<wink_>
I've updated the test to do u128 add and README.md to include how to generate the asm as well as having the asm loop.
hoppetosse has joined #zig
unique_id has joined #zig
mnoronha has joined #zig
hoppetosse has quit [Ping timeout: 244 seconds]
kristate has quit [Remote host closed the connection]
kristate has joined #zig
noonien has quit [Quit: Connection closed for inactivity]
kristate has quit [Ping timeout: 264 seconds]
<MajorLag>
andrewrk, I'm not sure what can be done about it, but comparing two tagged unions for equality is especially nasty. Getting the active tag of each is simple enough, but using that to get and compare the value rquires an inline for over the typeInfo UnionFields comparing the tag values. Anything else I've tried has lead to `unable to evaluate constant expression`.
<andrewrk>
I noticed this the other day
<andrewrk>
we can open an issue to track our discontent even if we don't have a proposal yet
<MajorLag>
problem is, the error isn't wrong. without the comparison between the fields taking place inside the inline loop, it can't work. Only thing I've come up with is to abstract the nastiness and use some kind of callback to a generic function, but that takes more lines of code to set up than you end up abstracting away.