Sounds like an acceptable modus operandi ;-)jb82 I had a quick look at a few implementations in the repo I linked above. What I found is, most of all, "straight forward", not "optimized".
I personally don't see a problem with that. Straight-forward and clear code should always be the first choice. It's robust, portable, avoids "esoteric" error conditions. You should never start optimizing unless you proved something actually is a performance bottleneck. Of course, that's pretty hard to judge for library functions, it very much depends on how they're used.
So, again, if you can come up with better code for some of these, with better meaning faster while still being readable, portable, etc ... then please do so![]()
strcpy()
I used as an example above.Well, it's just an exaggerated way to tell being careful with the interpretation"lies, damned lies and benchmarks"
I'd like to add that it really helps to have identical hardware configs when comparing performance of anything on FreeBSD vs. Linux.
After reading the definition of NP-Completeness on Wikipedia: https://en.wikipedia.org/wiki/NP-completeness, I have to generally agree... and in the spirit of Keeping It Simple, it may be a wise choice to stop at "Good Enough". Relentless pursuit of perfection very well could end up having a steeper price than "Good Enough".Optimizations are NP complete
If you manage to shave some cycles off the string functions and spend a day on that, how many calls to that function does it need untill you get a day in return?
(Emphasis mine.)(S)tress-ng will stress test a computer system in various selectable ways. It was designed to exercise various physical subsystems of a computer as well as the various operating system kernel interfaces...
(S)tress-ng was originally intended to make a machine work hard and trip hardware issues such as thermal overruns as well as operating system bugs that only occur when a system is being thrashed hard. Use stress-ng with caution as some of the tests can make a system run hot on poorly designed hardware and also can cause excessive system thrashing which may be difficult to stop.
(S)tress-ng can also measure test throughput rates; this can be useful to observe performance changes across different operating system releases or types of hardware. However, it has never been intended to be used as a precise benchmark test suite, so do NOT use it in this manner.
Yeah, but that's definitely not a typical use case. And even stress limits comparison only makes sense if run on identical hardware setups. If you run the stress test A on a Threadripper and on an Athlon, of course you'll notice that Threadripper will show far better performance.That can go very quickly if you work on software that is running on thousands of CPUs.
considering we get an optimized libc in FreeBSD saving cpu cycles, that day is earned very quickly, even more so on gnu libc because it is used on many more machines.If you manage to shave some cycles off the string functions and spend a day on that, how many calls to that function does it need untill you get a day in return?