Hacker News new | past | comments | ask | show | jobs | submit login
Why does an extraneous build step make my Zig app 10x faster? (mtlynch.io)
6 points by mtlynch on March 19, 2024 | hide | past | favorite | 3 comments



Buffering is also a factor in your test program. If you had done some kind of flush after echo, there wouldn't have been a 3 second delay before job B saw job A's output. The reason you saw the "42" output immediately is because job A ended, which flushes the buffer. If you had a sleep after the echo 42, then exited, job B would have been delayed again by the sleep amount.

Most languages allow setting buffer sizes and/or enabling line buffering so that flushes occur automagically on line boundaries. As a general rule, stderr is line buffered or not buffered, while stdout has a large buffer.


Oh, I didn't realize that. Thanks for the explanation!


Author here. Happy to answer any questions or take any feedback about this post.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: