On Wed, Jan 08, 2025 at 03:07:24PM -0500, Andres Freund wrote: > Out of curiosity, have you measured whether this has a positive effect without > pg_stat_statements? I think it'll e.g. also affect lwlocks, as they also use > perform_spin_delay().
AFAICT TAS_SPIN() is only used for s_lock(), which doesn't appear to be used by LWLocks. But I did retry my test from upthread without pg_stat_statements and was surprised to find a reproducible 4-6% regression. I'm not seeing any obvious differences in perf, but I do see that the thread for adding TAS_SPIN() for PPC mentions a regression at lower contention levels [0]. Perhaps the non-locked test is failing often enough to hurt performance in this case... Whatever it is, it'll be mighty frustrating to miss out on a >7x gain because of a 4% regression. [0] https://postgr.es/me/26496.1325625436%40sss.pgh.pa.us -- nathan