Emacs27 notmuch very slow

I switched to channel 20.09 recently, and that moved me from emacs26 to emacs27. I use emacs/notmuch for email, and after the upgrade to emacs27, emacs would hang for a few minutes while I tried to read email. I found that reverting to emacs26 avoided the problem.

Here are the key lines in my home.nix file:

Emacs = pkgs.emacs26;
EmacsWithPackages = (pkgs.emacsPackagesNgGen
emacs-with-packages = EmacsWithPackages emacs-select ;

I write this so that anyone else who has the same problem can use my fix. And also to ask if anyone knows of a fix that would let me move on to emacs27?