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.


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;
  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.

  • $\begingroup$ This question mathematica.stackexchange.com/questions/127523/… is not relevant; my question concerns static images. Even the sped up answer is choppy on my system. $\endgroup$
    – Adam
    May 27, 2023 at 23:31
  • $\begingroup$ I don't know how to test any ideas. This might work, but it seems cumbersome: Iconize[e, Rasterize[e]]. Could be done automatically through $PrePrint I suppose. $\endgroup$
    – Michael E2
    May 28, 2023 at 0:00
  • 1
    $\begingroup$ I recall there being a performance issue with large (much larger than the results from Rasterize[Plot[]]) images in the 12.x series. The only "workaround" is to avoid them. $\endgroup$
    – ihojnicki
    May 28, 2023 at 12:51
  • 1
    $\begingroup$ @RolandF, I'm surprised to hear you say that. The 13 Windows FrontEnd uses DirectX, so I would double check to make sure your graphics card driver is up to date and fully functional. $\endgroup$
    – ihojnicki
    May 28, 2023 at 12:53
  • 1
    $\begingroup$ Thats all checked. Its a notebook with intel UHD plus an NVIDIA MX150. Since I never get activity of the NVIDIA I switched off the Intel. No difference. After some search I concluded that the real capabilities of the graphics card are used only by special software. games of course. The Windows Dircect X is abstinent. For the ffmpeg engine to use the card it has to be loaded with CUDA switch on. This is not the case for the Intel machines for the Windows 10 photo and video environment. So I decided to build an AMD system for grandson who complained about miserable perfomance of notebook. $\endgroup$
    – Roland F
    May 30, 2023 at 4:31


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.