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

Steps to reproduce

  1. Download the following file. Note that it’s rather math heavy, but not overly long. (nevermind the css extension)

    example.css (4.2 KB)

  2. Copy the contents into a new Obsidian note.

  3. Open a preview of the note by Cmd+clicking. You should see both the editor and the preview at the same time.

  4. Type anything into the note. You’ll experience quite long typing latency (time between you pressing the key and the letter appearing on the screen).

Expected result

I’d expect near-zero typing latencies.

Actual result

Typing latencies around a quarter of a second.


  • Operating system: MacOS Catalina (latest dev beta)
  • Obsidian version: 0.7.1
  • Using custom CSS: Bear, but it shouldn’t matter

Additional information

I think the preview pane re-renders all of the math on every keystroke; maybe some React-style update pruning would work.


Uhm… we will look into it.
However, think how much lantency you have when you actually use latex? (you have to compile everytime)
or when you use Overleaf?

I tried your document and it’s doing pretty well.
What computer do you have?

I’ve also noticed severe slowdowns when editing a math heavy note and having the rendered version up side by side. I also thought the exact same thing, that the entire note was getting re-rendered on every keystroke (or something along those lines).

It’s actually not usable as it is now and I instead workaround it by editing a chunk of math and then flipping over to the rendered version to make sure that it looks correct, and then flipping back to just editing mode.

I’m not on the most powerful computer personally, it’s the 2015 12-inch MacBook. (1.1 GHz Intel Core M, 8 GB 1600 MHz DDR3, Obsidian version 0.6.7)

Uhm… we will look into it.

Thanks, @WhiteNoise!

However, think how much lantency you have when you actually use latex? (you have to compile everytime) or when you use Overleaf?

There’s more to unpack here. Firstly, Obsidian is a markdown editor, so let’s stick to its peers like Typora and VSCode for comparison. Secondly, I’m talking about typing latency (time from keystroke to the letter appearing), which is virtually nonexistent even in the LaTeX tools you mentioned.

Talking about VSCode (or any other markdown editor, for that matter), I think they traded typing latency for rendering latency; the preview doesn’t update in real time, there’s a miniature lag. I think that’s a good tradeoff — typing latency doesn’t have any place in a text editor.

I tried your document and it’s doing pretty well. What computer do you have?

Maybe it’s a Mac-specific issue? Or we have different standards? I doubt my gear is an issue (16GM RAM, i7 2.2GhZ) — and if it is, it certainly shouldn’t.

And @Alex2357, glad (and not glad) I’m not the only one having this issue! I’m of the opinion that a text editor should run on anything that is operable by a mouse — unfortunately I have to do the same workaround as you. Personally I’d prefer to have a small rendering latency rather than wait for every keystroke to appear.

Thanks. We’ll look into it.

@Eugleo: what year is your mac?

Mid 2014 15".

Thanks @WhiteNoise Just a guess, but it seems like the render method for the preview is maybe getting called on each update to the note buffer and debouncing this call could help.


Running into the same issue now. Dell XPS 15 9500. Closing the preview window reduces typing latency.

It looks like Obsidian uses Mathjax rather than the much faster Katex. How difficult would this be to change?

The new MathJax is on par with Katex and offers more features.

Could any of you send us a document (dropbox/gdrive) where you experience this problem the most?


MathJax 2 used to be slower than KaTeX, but we’re using MathJax 3, which is supposedly much faster.

We used KaTeX for Dynalist and it’s pretty good, except that it’s missing a bunch of functions and we get regular complaints about them.

1 Like

Math blocks are only re-rendered when they are changed. If your file separates each block of text using 2 line breaks (1 empty line) then they should only be re-rendered when you actually modify the source block.

I’ve downloaded the provided file to do some performance testing. There seems to be 3 major sources of performance slowdowns. My PC is too fast to experience any of them, but luckily the built in debugger can impose a 4x or 6x CPU slowdown, which shows the issues clearly.

  1. HTML sanitizer is a bit slow. I’ve added a patch for this one (should be in 0.7.6), but it’s mainly slow because it re-sanitizes the whole document on edit, where it should only be re-sanitizing the edited blocks.

  2. Blocks that contain many pieces of inline LaTeX would re-render all of them on edit. For now, not much I can do about that, but we do have plans for optimization in the future. See Performance issues when working with larger .md files (With video footage)

  3. The whole document having so many separate pieces of LaTeX causes significant layout strain on the rendering engine. This one I don’t have much to help, but we do have plans for small optimizations here and there that should cut down on the performance cost of this. First optimization will remove elements that are outside of view, and second optimization will “box” panes so having a crowded preview pane won’t impact another editor pane, for example.


I am going to archive this as we have made significant progress in this front in 0.8.2 and 0.8.4 If you still have issues, open a specific bug report.

Was trying to find out more about this and ended up on this thread.

For others that might stumble here, here is a good comparison of Katex, Mathjax 2.x and Mathjax 3.x.. Mathjax 3 outperforms Katex both in render time and types of equations it can support.

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.

Hi, I am also noticing noticeable typing lags on documents with heavy math. I am on a Dell XPS 13 from 2019.

Quoting a previous idea:

I also notice that the rendered equation is refreshed in real time, but only for display equations. For inline equations, you edit it the latex code that the rendered equation appears only when the cursos steps out of the inline latex block.

Could it make sense to do the same for display equations? Only render when the cursor goes out. Or at least add a timer so that the render refreshes only after certain intervals, like 1 second, or 2 seconds? That way it should not hinder typing lag. Just a thought.

Hey, just want to say that I have the same issue with a Macbook Pro 2020 13 inch wiht 8gb of RAM (Intel). Would be great to solve this!

1 Like

The issue in this BR is solved. If you have problems with a note, make sure that you can reproduce them in the sandbox vault (or no no themes, no plugins, restart).
Also, see if you have very long block of text not separated with with 2 line breaks (1 empty line). It helps with rendering.

If it still happens, create a new bug report and attach a copy of the note.