I love those days when I look for a solution to a problem (today: iptables performance using large net blocks) and I find some kind soul out there has spent their time to fix this already.
https://selivan.github.io/2018/07/27/ipset-save-with-ufw-and-iptables-persistent-and.html
Thanks Pavel ❤️