ChanServ changed the topic of #zig to: zig programming language | https://ziglang.org | be excellent to each other | channel logs: https://irclog.whitequark.org/zig/
laaron- has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
kristoff_it has quit [Ping timeout: 264 seconds]
laaron has quit [Remote host closed the connection]
stratact has quit [Quit: Konversation terminated!]
laaron has joined #zig
waleee-cl has quit [Quit: Connection closed for inactivity]
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron- has joined #zig
<daurnimator> mikdusan: I was thinking about that the other night. Could we set the popped stack to all `undefined`?
<daurnimator> (and tell valgrind?)
<daurnimator> that way valgrind can tell you about stack address escapes....
laaron- has quit [Remote host closed the connection]
laaron has joined #zig
<daurnimator> andrewrk: :( I'm sad you committed the start of noasync to master without replying to https://github.com/ziglang/zig/issues/3157#issuecomment-528916380
laaron has quit [Remote host closed the connection]
<mikdusan> daurnimator: hmm if valgrind has an api for that (i am oblivious) then something checking return values and in/out params sounds like a win in the pop-direction
<daurnimator> mikdusan: you tell valgrind which memory is undefined; then valgrind detects reads/writes to those areas.
<mikdusan> so nesting you are also responsible to remove the undefined range?
<mikdusan> (or maybe it's smart enough to watch the sp move).
<mikdusan> ugh. oh i see it just checks immediately. i get it.
laaron has joined #zig
<fengb> I have an odd bug where the switch expression returns the wrong value
<fengb> return switch(enum) { .match => foo catch bar }
<fengb> I wonder if it's related to copy elision
<fengb> "foo catch return bar" fixes it
stratact has joined #zig
donpdonp has joined #zig
ky0ko has joined #zig
Ichorio_ has joined #zig
Ichorio has quit [Ping timeout: 264 seconds]
Ichorio_ has quit [Ping timeout: 264 seconds]
_whitelogger has joined #zig
kristoff_it has joined #zig
kristoff_it has quit [Ping timeout: 258 seconds]
chemist69 has quit [Ping timeout: 252 seconds]
chemist69 has joined #zig
_whitelogger has joined #zig
ntgg has joined #zig
_whitelogger has joined #zig
mahmudov has quit [Ping timeout: 245 seconds]
lunamn_ has quit [Ping timeout: 246 seconds]
lunamn has joined #zig
_whitelogger has joined #zig
dingenskirchen has quit [Read error: Connection reset by peer]
dingenskirchen_ has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
dbandstra has joined #zig
<dbandstra> do the std fmt functions support printing c strings?
<dbandstra> i see some code in there which kind of looks like it could be but i'm not having success using it
<dbandstra> kind of hard to follow the code in fmt.zig
<dbandstra> oh, i got it... it's "{s}" (for some reason)
<dbandstra> for some reason i looked at fmt.zig and saw the "s", but my brain translated it to a "c" by the time i switched to my own source file, so i'd try that and it wouldn't work
ntgg has quit [Ping timeout: 258 seconds]
dbandstra has quit [Quit: leaving]
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
laaron has quit [Remote host closed the connection]
laaron has joined #zig
mahmudov has joined #zig
<mq32> hey
<mq32> i am saddened. it seems like i can't flash my µC right now, something is broken
kristoff_it has joined #zig
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
TheLemonMan has joined #zig
donpdonp has quit [Read error: Connection reset by peer]
<TheLemonMan> nice, build.sr.ht is now failing for no reason
<daurnimator> TheLemonMan: the reason is spite
laaron has quit [Remote host closed the connection]
alexander92 has joined #zig
<TheLemonMan> I guess it hates Zig and all it represents
laaron has joined #zig
kristoff_it has quit [Ping timeout: 246 seconds]
laaron has quit [Client Quit]
laaron has joined #zig
TheLemonMan has quit [Quit: "It's now safe to turn off your computer."]
<mahmudov> just curious why zig causes spite?
bastienleonard has joined #zig
drazan has quit [Ping timeout: 245 seconds]
dingenskirchen_ is now known as dingenskirchen
ofelas has joined #zig
<Yardanico> wow, I found https://github.com/nrdmn/awesome-zig
<Yardanico> although for smaller languages it might make more sense to have an awesome repo in their own github organization
<Tetralux> Huh. Didn't know my sublime syntax was on that. Neat :)
lunamn_ has joined #zig
lunamn has quit [Ping timeout: 264 seconds]
Ichorio has joined #zig
ntgg has joined #zig
<gonz_> `awesome-zig` is bound to be out of date for a long time
<gonz_> And I don't think there's any way to tell something is actually "awesome" yet.
<Tetralux> I mean... There is: Informality. ;)
<Tetralux> .. which is how that repo intends it, I suspect.
<Tetralux> But I also get what you mean.
<Tetralux> Though, perhaps in some sense Zig's wiki page for community stuff could be that.
<Tetralux> That has a much lesser list.
<gonz_> Usually these lists will de facto be "Here is what people use", whereas one for a very young language will be "Here is what the owner of the repo + people who have made PRs know exists"
<gonz_> Those aren't equally useful
<gonz_> Though I'm open to the idea that I'm wrong and many of the `awesome-*` repos are just people tossing everything they know in there.
<Tetralux> That's what I imagine it is.
<Tetralux> Maybe they even tested it too - who knows :p
<fengb> He put my silly protobuf experiment on the list. I feel compelled to make progress now :(
<Tetralux> He put zigpaint on there too ;P
<Tetralux> Still
<Tetralux> I don't really care
<Tetralux> First time any repo of mine's been mentioned anywhere so
<Tetralux> I feel accomplished in life now.
alexander92 has quit [Ping timeout: 268 seconds]
<Yardanico> how can I tell translate-c to translate parts which are not used?
<Yardanico> or how can I make it believe that some parts are "used"
<dingenskirchen> I'm trying to build a minimal TCP server using the stdlib, but ran into an issue I don't quite understand: https://pastebin.com/hvP4FLCq
<fengb> Network code hasn’t been updated to the new async semantics yet
<fengb> Anything in std.event is currently in flux
<dingenskirchen> ah :|
<dingenskirchen> guess i'll wait and see if it works after the next release, then
<dingenskirchen> thanks for the quick response though
<fengb> I think the goal is to get it better by 0.5.0 but not sure if there’ll be enough time
<Yardanico> I think I found a (regression?) in the compiler, or maybe it should be the correct behaviour - https://github.com/andersfr/zig-lsp/pull/4#issuecomment-529118623 (zig-lsp fails to compile with the latest compiler, but compiles fine with a7fd1409
<Yardanico> It works if I remove "orelse null" from that line though
<Yardanico> I think 2045b4d is the cause (the commit before it works, and on it it starts to fail)
<fengb> That looks like a bug
<nrdmn> gonz_, Tetralux: For now I put anything in the list that doesn't look like a test repo. I hope it is useful in case someone wants to check if there are projects of a certain topic to get inspiration from.
<nrdmn> As soon as there are more and more mature projects, I'll have to start to filter
<Tetralux> nrdmn: That's what I figured. :)
<Snektron> Tetralux: did you also publish the sublime text syntax?
<Snektron> Because i made a pr that was merged like a half year ago and it still needs updating
<Tetralux> You mean the one that's available through package manager?
<Tetralux> No. I started out with that, but did not find it to my liking, so I made my own.
<Tetralux> I update it whenever I'm using it and it doesn't do something that I think it could use.
<Tetralux> '&&' highlights as illegal, for example.
<Snektron> Oh nice
<Snektron> Care to send me that?
<Snektron> Thanc
mahmudov has quit [Ping timeout: 268 seconds]
<Tetralux> y7
<Tetralux> o7*
Akuli has joined #zig
ntgg has quit [Ping timeout: 244 seconds]
Tetralux has quit [Ping timeout: 244 seconds]
<gonz_> andrewrk: I painstakingly added library annotations to everything I could find info on and that wasn't some interface stub/proxy or obviously some libc function: https://github.com/GoNZooo/zig-win32/blob/master/src/win32/c.zig
<gonz_> Unfortunately the modular windows headers were no real help, because they contain almost nothing.
<gonz_> At some point I should come up with a smarter way of doing this
<andrewrk> gonz_, fortunately I don't think it changes often, and ABI compatibility is stable
<gonz_> All in all I guess it wasn't so bad, but it took a couple of hours.
<andrewrk> yeah that's practically nothing in terms of developer hours
<gonz_> There are some pretty unqualified guesses in there as well, based on their surrounding functions being from some lib, etc.
<andrewrk> if it's a one time task
Tetralux has joined #zig
mahmudov has joined #zig
so has quit [*.net *.split]
mahmudov has quit [*.net *.split]
mahmudov has joined #zig
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
so has joined #zig
so has quit [Max SendQ exceeded]
curtisf has joined #zig
so has joined #zig
<andrewrk> I don't remember who was asking about glibc 2.30 but that's in master now
<curtisf> Is there a good way to profile a zig application on Windows?
<andrewrk> I don't know the answer to that question but I also want to know. It should be the same answer as how to profile a C/C++ application on Windows
<gonz_> Debugging works with VS & WinDbg, so I assume VS works.
<curtisf> I'm not sure if my VS is just outdated or if there's some reason I can't find the cpu profiling tab
<Sahnvour> curtisf: it's usually under the "DEBUG" menu
<gonz_> Looks like Debug -> Performance Profiler, yeah.
<Sahnvour> I mainly use VTune when the executable is not build via a VS project though, it's less of a hassle than profiling random executables inside VS
<andrewrk> Sahnvour, oh that's good to know. I've been using an empty Project1.sln and just overriding the exe to whatever I wanted to debug
<gonz_> andrewrk: You can run `devenv binary-name.exe` to open up an on-demand project
<andrewrk> nice!
<gonz_> for that exe
Aransentin has joined #zig
<Sahnvour> trying to profile zig0 (for example) from on-demand project, the CPU Usage tool is greyd out
<curtisf> Sahnvour: I don't see that there. Is it supposed to be in these menus? https://imgur.com/QC9YimV
<Sahnvour> curtisf: you're currently debugging a running executable, it won't be available until you stop it
<curtisf> Ooo, thanks
<Sahnvour> then it's performance profiler > CPU usage > go
<gonz_> VS ¯\\_(ツ)_/¯
<curtisf> hmmm I still don't see it https://imgur.com/DVc4UPC
<Sahnvour> what does your current project (inside the solution explorer pane) look like ?
<curtisf> It's just the EXE. (I have no idea how to use VS, but this is how I managed to debug before)
<Sahnvour> strange, can you right click on it and set it as startup project ?
<Sahnvour> here's what it looks like on my machine https://i.imgur.com/V4ElA2k.png
<curtisf> I clicked that, it doesn't seem to do anything. Maybe I should just try updating
mahmudov has quit [Ping timeout: 252 seconds]
<gonz_> Sahnvour: Is VTune usually a better choice?
<Sahnvour> I think so
<Sahnvour> it has more info
<gonz_> Oh, being that you seem to be in the know: Is there a good interactive disassembler that works well with zig on Windows?
<gonz_> I tried about 10 or so ones and they all had issues, most of them were anonymizing the names of every function for no reason.
<Tetralux> gonz_: VS is the best I got, I'm afraid.
<Sahnvour> overall VTune is better I think (and free since some time), a lot more full featured, but a bit less user friendly
<Sahnvour> I don't know about disassemblers, sorry
<gonz_> Tetralux: Yeah, it's what I use, but it's not nearly as nice as some of the disassemblers you can use for C/C++.
<gonz_> The interactive ones with tree structures, etc.
<gonz_> Or am I just missing features that VS has?
<Sahnvour> iirc the good ones have to be bought right ?
<gonz_> Some of them are free and from what I gather they do the whole tree structure thing for C/C++
mahmudov has joined #zig
<gonz_> But somehow they just fail at preserving the names of functions in zig
<Sahnvour> no it's very barebones, maybe WinDBG preview (note the _preview_, it's on windows store also :)) is a better
<gonz_> I haven't needed it yet, but I was curious when I saw the really interesting ones whether or not they'd work for zig
<gonz_> in the end the info I wanted I got from VS
<Sahnvour> in my experience, it's hard to get good asm <-> source line matching in release-fast for zig
<Sahnvour> I don't know why
<Sahnvour> so for example you would try to profile a piece of code, but the actual costly instructions will all get mapped to some function at several outer scopes, basically where it wasn't inlined (eventually just main)
<Sahnvour> and since all the generated code inside this call refers to the single line of the function call, it's rather useless
waleee-cl has joined #zig
<curtisf> It looks like I just needed to update VS. Does VS provide anything finer than function-level profiling? In my case I have one large function and only about 10% of its runtime is attributed to sub-calls
Akuli has quit [Quit: Leaving]
<mikdusan> given `const X = packed union { small: u32, big: u64 }` what is the expected alignment for X?
<Sahnvour> curtisf: yes you can see line-level information
<Sahnvour> you could even see instruction-level before, but I can't find it anymore since VS2017
<Sahnvour> make sure to generate a full report from your profiling (ends up with a .vsps file) and then you can browse your code with inline costs :)
curtisf has quit [Remote host closed the connection]
curtisf has joined #zig
<curtisf> Sahnvour: sorry for bugging you repeatedly, but you have been helpful so far :) Do you know I get there? From googling it looks like there should be a "Performance Explorer" window that I'm not seeing
<Sahnvour> no problem
<Sahnvour> did you get a report after profiling ?
<Sahnvour> when you stop or the process ends, it should automatically open a tab with a report inside it
<Sahnvour> listing the top functions or something like that
<curtisf> Yep, I see that
<Sahnvour> okay then I think that's the "oopen details" link
<Sahnvour> used to be "generate detailed report" iirc
<Sahnvour> if I'm right, it will process for some time and then show you a hot path view
<Sahnvour> from where you can navigate to functions
<Sahnvour> the "function details" view is especially useful
<curtisf> OH, I see, thanks!
<Sahnvour> you're welcome
<scientes> andrewrk, how do i get the file name in gdb again?
<andrewrk> scientes, AstNode::src()
<andrewrk> e.g. (gdb) p instruction.source_node->src()
<scientes> sweet
<scientes> *sweat
<scientes> ....
<Yardanico> im sorry for asking that question but how do I print ascii value of a byte - u8 ?
<andrewrk> if you are using formatting facilities I believe {c}
<scientes> you also might want to test if it is ascii
<Yardanico> thanks :)
<andrewrk> fengb, I've fixed both the "Instruction does not dominate all uses" bugs regarding async/await. But it looks like there are a few more corner cases to solve, will open new issues soon
<andrewrk> stability is improved though
<Tetralux> kristoff_it: Can you run that fast float parsing example measurement again... only with --release-fast on, it's ten times slower than when I wrote it...
<andrewrk> I'm down to just https://clbin.com/hZb4l for making std.os.read event-based-capable
<Tetralux> Can someone else also pull down my fast float parsing example and measure it too
<Tetralux> I'm expecting ~12ns and ~235ns, respectively.
<Tetralux> But I'm getting ~144 and ~235.
<Tetralux> I literally haven't changed anything that should affect it that much - so far as I'm aware.
<scientes> I'd rather the ryu parser that tgschultz is writing IIRC
<fengb> That’s output, not parsing
<scientes> oooo
<tgschultz> sorry, you've got the wrong guy
<scientes> but its lossless
<scientes> > Ryu & Ryu Printf Build Status
<scientes> yeah it goes both ways
<Tetralux> and by "measure", I mean "run" xD
_whitelogger has joined #zig
curtisf has quit [Remote host closed the connection]
reductum has joined #zig
<mikdusan> Tetralux: nuke use of error union return value in parseFloat()
<mikdusan> make it just return T
laaron has quit [Quit: ZNC 1.7.1 - https://znc.in]
laaron has joined #zig
<andrewrk> tiehuis is the one working on ryu
<andrewrk> I wonder what he's blocked on. I'd really like to clear the path for him
<stratact> andrewrk: I have a quick offtopic question (I don't want to derail). How is FreeBSD's debug-mode output system coming along?
reductum has quit [Quit: WeeChat 2.5]
<andrewrk> stratact, you mean, e.g., stack traces?
<stratact> yeah
<andrewrk> It was my understanding those were working at one point in time. We have stack trace regression tests now thanks to mikdusan but I believe they are not yet enabled for FreeBSD
<stratact> Gotcha, thanks for the update.
<andrewrk> If someone goes through the trouble of fixing them and enabling test coverage, they'll stay working
<andrewrk> Personally, I'm prioritizing language stabilization over FreeBSD support, although I do plan to dedicate time to it eventually
<stratact> I might check it out once I get better at Zig
<andrewrk> stratact, have you seen the support table / tier system?
<stratact> Gotcha, I'll refer to the Support Table
<stratact> Well this would be a great way for me to help out
<andrewrk> :)
<andrewrk> stratact, see also https://github.com/ziglang/zig/issues/1759
<Tetralux> mikdusan: That's weird. That does help, but it's nowhere near what it was before.
<Tetralux> And of course, that's at best a stop-gap
<Tetralux> since it was really fast with the error union return values before.
<mikdusan> i basically did that and get ~15ns
<Tetralux> Mine is 10 times slower.
<Tetralux> And mine _was_ as fast as yours yesterday.
<Tetralux> That's so strange.
<Tetralux> Or day before
<Tetralux> Either way
<Tetralux> Something's very weird.
<mikdusan> err wait. heheh i garbled the diff.
<andrewrk> in theory if you kept everything the same but put `catch unreachable` instead of `try` it should have the same effect
<andrewrk> in main()
<Tetralux> AH-HA
<mikdusan> Tetralux: ok i updated gist and just put the full source there. the original was an older pastie from you that i lost.
<Tetralux> Replace everything with catch unreachable, and leave the `try parseFloat(...)` in main.
<Tetralux> It compiles and is slow.
<Tetralux> Remove the try.
<Tetralux> Back down to 11ns.
<Tetralux> I spy a compiler bug.
<Tetralux> Oh wait
<mikdusan> btw ignore the @setRuntimeSafety ... has no effect on release-fast
<Tetralux> Sigh. Nevermind...
<Tetralux> I feel like I've been bitten by that one before.
<Tetralux> Replaced everything with catch unreachable, but left the rettype as !T
<Tetralux> Wasn't then checking the return value for error or not
<Tetralux> However
<Tetralux> There's still a bug in codegen or something here.
<Tetralux> Removing the error union from parseFloat's return type _does_ fix the slowdown.
<Tetralux> BUT
<Tetralux> It was working at damn-near the same fast speed with the error unions a day or so ago.
<Tetralux> And now it's ten times slower.
<Tetralux> And now it's ten times slower.
<Tetralux> Oops
laaron has quit [Remote host closed the connection]
<Tetralux> Wrong window again xD
<Tetralux> I keep switching back to IRC pressing up-arrow and enter expecting it to focus my terminal xD
<Tetralux> Changing the callsite from `try parseFloat(...)` to `parseFloat(...) catch unreachable;` makes it speed up again.
<mikdusan> ok i have a 1-liner for you to go from 164ns -> 16ns: https://gist.github.com/mikdusan/0e389b4a8d1d44489eafbf364cef5a1a
<mikdusan> yup. callsite.
<Tetralux> I feel like the bool and the value in the error union was getting allocated to a cpu register before
<Tetralux> but now it checks the bool and then copies the value out of main memory.
<Tetralux> Could that be it?
laaron has joined #zig
<Tetralux> Interestingly, doing the `catch unreachable` trick does NOT speed up std.fmt.parseFloat if you do it to that call.
<Yardanico> Maybe because it also calls another function by itself?