systemd-swap is fine too.
In my case … I want swap used as little as possible … but want to make sure it has a decent pool to pull from if needed. So its at equal to my RAM and low priority and then I dont have any other services or worry about it.
(I have dozens of FF tabs open, telegram, some terminals, etc … so my RAM use is ~50% and my swap isnt being touched … which is what I want.)
I have 8GB RAM, so I use dynamic swap file plus zswap and zram. It’s an automated solution that I love, because since I set it, there are no more perma-freezes because of RAM depletion. It works great on SSD, because swap is almost as good as RAM and new allocation of space is done quickly in the background, without any noticeable bad effects.
I use a swapfile, currently 4 GB on most of my machines.
It is easier to handle. If I want to change the size, create a new one or delete one, I can simply do this while the system is running, without booting in a live system to resize partitions.
For me the best option so far, using this setup for some years now.
A good question is: what happens with a default installation of the OS? I happened to install on a laptop, I5, 8GB mem. and an SSD a few months ago and… there is no swap. Thanks to your suggestion I installed a swap file but then again it depends on your usage and of course you never know but the idea of swap dates from a time where memory was a problem like 512 MB or even less. Never forget that 512 KB was a lot in 1990, the year Linus started. So I guess swap will become obsolete in the years to come, there will be ample resources.
Only 8GB here (max on this system unfortunately) and it’s usually heavily loaded. The browser is the biggest memory hog, in particular when viewing YouTube videos, but I always have watch -n5 free -h running on one of the Terminal tabs to keep an eye on things & restart the browser when necessary, esp. when I’m running virtual machines.
I have a 10GB swap partition & performance starts to suffer when it gets around half full, which is to be expected.