# Lag problems when writing answers

I've had a recurring problem when writing answers: a massive lag between typing and seeing the text appear. It got unbearable for this question, probably due to the enormous length of the answers and the many formulae.

I am not sure if this is a problem with my system (I use Mac OS and Safari is my browser... so yeah, the trouble could well originate there ;) ). If other people are experiencing this issue too, I think it should definitely be fixed (if that's the case maybe ask on main meta site?). It severely impedes the writing of answers, I had to pre-write my answer in a text document and copy it in.

• Macs tend longer used, but their CPU is slow. And the MathJax (javascript/css/html latex interpreter) is relative CPU-costly. Macs tend to be upgraded more rare, partially because Apple likes to close them out from the compat list of their newer macos version (light "encouragement" to buy your next mac). And older Macos-es have older safari. The javascript interpreters were optimized a lot in the last years, mainly to handle the appearance of the tremendous sized javascript frameworks, like mathjax. – peterh Jul 27 '16 at 10:05
• So: 1) do you see a correlation with the existence of the latex formulas in the post? 2) What if you use some other browser (f.e. firefox for mac)? 3) How old is your mac, what is your safari version? – peterh Jul 27 '16 at 10:07
• I agree that a function to turn off the automatic updating of the preview as one types would be helpful (windows 10, chrome, intel atom x5-z8500) – Sanya Jul 27 '16 at 10:12
• @peterh Safari version: Version 9.1.1 (11601.6.17). Mac OS version: 10.11.5. Mac book from 2011. – Wolpertinger Jul 27 '16 at 13:54
• This was a problem for a while in an earlier epoch, which has (had?) been largely resolved. Without multiple reports it's hard to know exactly what is going on. You can try a hard refresh on effected page or closing and relaunching browser. – dmckee --- ex-moderator kitten Jul 27 '16 at 14:08
• @dmckee thanks! tried refreshing and relaunching browser, didn't help :( it's also a recurring problem – Wolpertinger Jul 27 '16 at 14:10

This is generally dependent on the user's system, so the only surefire way to consistently improve it is to upgrade your system. That said, there will always be a point where the page is too big for the MathJax update to work smoothly.

This has been answered in the Mathematics Meta site, Feature request: user script or option to turn off instant MathJax rendering. Quoting Jack Schmitt's answer there directly:

I don't know how you want to do user scripts. I use bookmarklets mostly.

To pause it:

javascript:(function(){MathJax.Hub.queue.pending=1;})();


To turn it back on:

javascript:(function(){MathJax.Hub.queue.pending=0;})();


Presumably something similar can be done with automatic solutions like greasemonkey. The turn-it-back-on does not request an immediate render, but you can add the:

MathJax.Hub.Queue(["Typeset", MathJax.Hub, "wmd-preview"])


to the bookmarklet yourself if you'd like. Turning it back on may cause a delay; if so I can adjust the script to more drastically disable mathjax.

A bookmarklet is simply a bookmark where the URL has been switched to the given javascript code.

If you want to keep the updating but just make the wait longer for each refresh of the preview, this userscript should be able to do the job with a suitable delay.

If you are writing a very long answer, I find StackEdit to be a good tool, and it enables you to draft and save long posts in Markdown + MathJax.

As a more extreme solution, you can get Privacy Badger (which is a good thing to have anyway) and temporarily disable all content from cdn.mathjax.org to disable all math rendering.

If the lags persist even with MathJax disabled then that is definitely something to report.