High typing latency when authoring a math-heavy note with linked preview

I am seeing extremely poor performance (high typing latency) in MD files making “heavy” use of latex blocks. In my case, I would quantitatively say that increased latency is clearly noticeable with more than 25 latex blocks, it becomes very annoying at 25-50 latex blocks, and it becomes difficult to actually track the cursor in the edit window with > 75 latex blocks. In my case, most of the latex blocks are short, between 10 and 50 characters.

I read the following:

Normally, when you use proper headings and markdown blocks (generally anything separated by a completely empty line in between), the app can recognize each block, and only re-render unchanged blocks.

in this bug report:

as well as the rendering comments in this bug report.

I’m currently using a 4.2Ghz quad core i7, 2018 iMac with 64GB RAM. When I have a MD file with a substantial number latex (mathjax eqns) in it, the typing latency becomes enormous if a linked preview window is open.

I do have many markdown blocks and headings breaking up the file, but as the number of latex blocks build up in a file, the apparent latency in the editor window continually increases until editing is essentially impossible.

I am wondering about possible ways to mitigate this issue. Some examples that have already been mentioned:

  • only rendering changed MD blocks.
  • only rendering MD blocks that would render in the visible viewport of the preview window (always including the block currently being edited).
  • reducing the compilation frequency of the preview window.
4 Likes