zram
The zram kernel module provides a compressed block device in RAM. If you use it as swap device, the RAM can hold much more information but uses more CPU. Still, it is much quicker than swapping to a hard drive. If a system often falls back to swap, this could improve responsiveness. Using zram is also a good way to reduce disk read/write cycles due to swap on SSDs.
Install the zram-generator package and copy the example configuration:
pacman -S zram-generator
cp /usr/share/doc/zram-generator/zram-generator.conf.example /etc/systemd/zram-generator.conf
Edit the copy of the example configuration to your liking. Comments explain what each setting does.
Example config
[zram0]
# Disable limit beyond which zram-generator will skip device creation
host-memory-limit = none
# Size of the zram device, half of total RAM
zram-size = ram / 2
# Compress memory pages with zstd right away
compression-algorithm = zstd
# Enable discard of freed blocks on zram device to keep it as small as possible
options = discard