Preventing slow performance with smart groups
Do you have a few smart groups on which many others depend? If so it's worth making sure they're as quick as possible. We have a script that generates the important ones once per hour - but by putting the contacts into regular groups, rather than smart groups. Regular groups are much faster, and that speeds things up a bit.

We've also turned off smart group caching. This very much depends on your use-case. But if you have a lot of intermittently-used smart groups it can be better to generate each one as needed rather than have a cron job regularly slow everything down by generating them all. But obviously ymmv on this.