I like to have images in between code and text cells. Whether they are pasted (in a default Input cell) or generated (in an Output cell), they slow down the front end considerably. When part of an image is visible, scrolling is noticeably choppy; as soon as it goes out of view, scrolling is fast.
If the notebook is exported as a PDF, a PDF reader renders the document quickly; presumably it loads all assets in memory so that there is no compute cost for showing images or rendered text. I want similar behavior in a notebook.
Question
How can I save an image in a notebook that doesn't slow down the front end?- Is there a magic set of cell options (I tried fiddling with editable/evaluatable)?
- Are there cell types that don't let their contents be unloaded from memory?
- Does a plain Image do continual processing that leads to sluggishness?
- Is there a different Head or wrapper for Image that is more 'passive'?
Here's a weird way of viewing memory over time; it sort of supports the idea that the images are unloaded (though that's not really the main issue). The plot itself contributes to memory, so it's a pretty bad way of measuring.
i = 1;l = 1 + 0 Range@400;
Dynamic[Refresh[
l[[i]] = MemoryInUse@$FrontEnd;
i = 1 + Mod[i, Length@l];
ListLinePlot[Log10@l, PlotRange -> {8, 10}],
UpdateInterval -> .1]]
I'm on 12.1.1 on OSX. I'll post a video of the choppiness in a couple hours.
Iconize[e, Rasterize[e]]
. Could be done automatically through$PrePrint
I suppose. $\endgroup$