Tell macOS to only use swap and compressed memory when really needed (macOS 10.14 Mojave)
I have the same issue and completely sympathise. Unnecessary swapping in the face of other options (e.g. shrinking the cached files area) has been a problem for years. It's made even worse under Mojave, where free memory - not even disk cache, but completely free - is present, but the system decides to use swap anyway. On an SSD, every write causes wear &amp; tear to the hardware, so this is actually (albeit in a small way) physically damaging behaviour. Since the SSDs in modern Macs are soldered onto the main board, the situation is dire.

I've been told many times by very confident posters on sites such as this that free memory is a bad idea, because it's sitting there consuming power and being of no other use. Disc cache (at least) should consume it. I agree with this; Mojave does not, compressing data and swapping it to disc even when gigabytes of free memory are present. On my home laptop, sleep cycles make it even worse. Right now, after a wake-up the machine has 11GB free, 5GB in use and 6GB swapped. The gibberish "memory pressure" colour is green, whatever that means. It's utterly absurd and indefensibly broken.

I used to think there must be something I was installing or doing wrong, but on brand new Macs at work with nothing extra installed, consuming RAM via opening lots of tabs in Safari will soon enough show use of swap space despite lots of free RAM.

And yes, it lags - badly at times. This definitely has a performance impact.

I know of no solution. Apple Engineering claim it 'works as designed'.