News for hackers. Stuff that matters.
Re:Curious lack of sprintf scaling by PandaPanda150 on Friday February 25, 2022 @06:01PM (#30473435)
Classic use-case where a posix rwlock will outperform a mutex.

How often does the locale change in practice? Almost never.

Re:Curious lack of sprintf scaling by hinkley on Friday February 25, 2022 @06:12PM (#30473516)
With most locking logic, it’s a series of escalations from the most optimistic/polite to least polite solution, and the worst case behavior is when a sequence always goes to the worst case scenario. In these situations, assuming the worst up front, and jumping straight to it or something very similar saves a lot of bargaining that leads to cache pressure and branch prediction.

ETA: It's also quite common in engineering blogs for languages, libraries or frameworks, an entry detailing how in the new version they have made a performance improvement by making the fast case faster, or the predictor more accurate, and then removed option 2 from the decision tree, so that we get a bigger benefit from the happy path and the average case, and as a benefit the system is now simpler as well.

Re:Curious lack of sprintf scaling by loeg on Friday February 25, 2022 @06:34PM (#30473706)
rwlock still require contending on a shared, mutated cache line. Something like RCU would bypass that.