Even with swap, 8gb is pretty paltry on a memory-hungry system like MacOS, let alone a system that shares GPU and system memory. 16gb is the minimum for me even though I really only edit/compile code, and even then it can be pretty easy to max out your system memory after a couple docker containers...
It might not be a 'trick' per-se, but anyone who intends to use a Mac for work should consider upgraded memory (IMO).