* https://cvsweb.openbsd.org/src/
* https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/
* https://cvsweb.openbsd.org/src/
* https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/usr.bin/ssh/
Again I mostly admire OpenBSD. But OpenNTPD is not the best example of their work.
Maybe I'll check that at home (where I replaced FreeBSD's ntpd with OpenNTPd).
There are better NTP implementations now. Chrony is great, it's the default in Ubuntu now. NTPsec is coming along although I haven't tried to use it myself. Also good ol' ntpd is greatly improved.
Once had to make some changes to OpenSSH for an internal project and it was surprisingly easy to find the relevant code and make the necessary changes. One of the few times my code worked on the first compile.
https://www.openbsd.org/faq/pf/perf.html
:
A single "noop" in a 755 file.A C true would be: https://cvsweb.openbsd.org/src/usr.bin/true/true.c?rev=1.1&c...
Here's a much faster true(1) if you need it: https://github.com/coreutils/coreutils/blob/master/src/true....
I don’t see how those examples are relevant. Why would that last one be faster?
I agree that the OpenBSD code here is good, no more and no less than needed.
I assumed the grandparent was referring to cases where an O(n) algorithm is used where it might be O(log n) or O(1) with just a little more effort. It’s a tradeoff, sure, and in some cases linear searches can work surprisingly well, but in general I think this kind of thing should always be considered in good code.
Micro-optimizations like inline assembly for inner loops may or may not be a good idea, depending on the application. All else being equal, I’d certainly agree that good clean code would not use assembly.
I would expect the openbsd true to be the fastest, it doesn't need to spawn a subshell and it doesn't do more than the posix specification requires (afaik --help/--version should be ignored).
time { for i in $(seq 1 10000); do /path/to/true; done; }