At some point one of my SageMath Jupyter notebooks became very slow to respond to the mouse and keyboard: mouse clicks now take several seconds to register and keystrokes appear only after a long lag. When the notebook is opened in a browser tab, it can take five minutes or more for any of the cells to show up. I have other notebooks open in the same browser window that load instantly and are very responsive. I'm running in Safari on a MacBook pro.
I tried many things to rectify the issue, including restarting the kernel, clearing all outputs, shutting down the kernel and restarting, shutting down the browser, shutting down the machine, and creating a copy of the notebook and running that. None of these had any effect. This notebook does not contain any graphics or any particularly large input our output cells. I finally solved the issue by extracting all input cells by hand and copying them into a fresh notebook. This fresh notebook now has essentially the same visible content as the old one, but is much more responsive and loads right away. Evidently there is some invisible content in the old notebook that is causing issues.
Can anyone suggest a work-around that is less cumbersome than what I ended up resorting to? Any ideas as to what might have caused this?