567 karma · joined February 1, 2017
Designed/Built/Deployed Meta's backend operating system for the last 7 years
https://totalrealreturns.com/s/VFINX,VBMFX,USDOLLAR,INTC?sta...
I know not being a library has different considerations, but some ideas I used in timeout(1) to kill a process group may be useful. Tricky things like using sigsuspend() to avoid signal handling races.
https://github.com/coreutils/coreutils/blob/master/src/timeo...
cgroups might be another avenue to explore, being more modern and so having less compatibility baggage
I was calling this "responsive idempotence" when discussing how the GNU coreutils are tested:
The reason it is useful is because yes can output anything, and so is useful to produce any repeated data for test files etc.
You can see the justification detailed in the original optimization commit: https://github.com/coreutils/coreutils/commit/35217221
tee -p >(command | line)
Note the -p option available now with GNU tee that doesn't exit tee if the pipe closes earlyhttps://www.pixelbeat.org/docs/unix_file_replacement.html
Note the caveats listed there
https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodb...
https://www.gnu.org/ghm/2011/paris/slides/jim-meyering-goodb...
BTW some notes on how the GNU coreutils are tested are at: https://www.pixelbeat.org/docs/coreutils-testing.html
$ echo $(((($(date +%s -d 'Aug 31') - $(date +%s -d 'Jul 1'))/(60*60*24*7))))
8 # 8.7 weeks truncated
$ echo $(((($(date +%W -d 'Aug 31') - $(date +%W -d 'Jul 1')))))
9
It's useful to get the number of weeks from git logs for release notes etc., which can be done like: oldvs='v1.0'
oldts=$(git log -n1 --format="%at" "$oldvs")
weeks=$((($(date +%s) - $oldts)/(60*60*24*7)))The findnl script as part of fslint identifies problematic patterns, and has 4 levels of stringency, with "POSIX" being the most stringent. https://github.com/pixelb/fslint/blob/master/fslint/findnl
"cksum [-a crc] is now up to 4 times faster by using a slice by 8 algorithm, and at least 8 times faster where pclmul instructions are supported."
Implementing that portably is a bit tricky, as one must consider:
- support various compilers which may not support intrinsics
- runtime checks to see if the current CPU supports the instructions
- ensure compiler options enabling the instructions are restricted to their own lib to ensure the don't leak into unprotected code.
- automake requires using a separate lib for this rather than just a separate compilation unit
BTW we also introduced avx intrinsics for `wc -l`