4 ms·
As an aside, the Go solution provided in the post has the following curious property. If you have to call `write()` 10k times (say, in a loop), and get an erro
by espadrine 12y ago
As an aside, the Go solution provided in the post has the following curious property.
If you have to call `write()` 10k times (say, in a loop), and get an error on the first write, instead of either unwinding (in C++) or returning (in Rust), that Go solution requires your program to check for nil 99,999 times.
- dbaupp 12y agoTo be fair, the Rust approach is mostly the same as the Go one on the machine, just harder to screw-up: the discriminant of the enum has to be checked to be able to extract the value (or extract the error) which is similar to checking `err` for `nil`.
- chrismorgan 12y agoI’d also estimate that of all the `write` calls the first is by a considerable margin the most likely to fail.