3 ms·
Why does an extraneous build step make my Zig app 10x faster?
- mtlynch 3y agoAuthor here. Happy to answer any questions or take any feedback about this post.
- prirun 3y agoBuffering 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.
- mtlynch 3y agoOh, I didn't realize that. Thanks for the explanation!