4 ms·
If you are at all concerned with performance and can sacrifice a couple features (fewer supported text formatting options & mathematical elements, less legacy s
by orange3xchicken 6y ago
If you are at all concerned with performance and can sacrifice a couple features (fewer supported text formatting options & mathematical elements, less legacy support for some browsers). Katex is a great alternative.
https://katex.org/ https://katex.org/
- williamstein 6y agoLast time I compared Katex to MathJax, I was also very pleased by Katex's synchronous rendering support, as compared to mathjax. In CoCalc.com I made it use Katex, but if there is an error it falls back to MathJax.
- raphlinus 6y agoMathJax can do synchronous also, but it's a config option. The fact that it defaults to async really saddles it with the perception that it's incredibly slow. The async operation basically forces the browser to through many, many rounds of relayout, when in most cases it would be much more efficient to do it in one batch.
- webmaven 6y ago> In CoCalc.com I made it use Katex, but if there is an error it falls back to MathJax. What % of Katex's rendering attempts fail over to MathJax?
- williamstein 6y agoI don't track that, but based on last time when I broke the fallback... it is important to have the fallback. There are cases where MathJax can handle input that is technically not valid in modern latex, and the katex devs explicitly decide not to support that input. My users don't care and have lots of content that works in mathjax only, so I have to support it (since Jupyter compatibility is important, and Jupyter uses mathjax).
- 0-_-0 6y agoActually, the recent MathJax 3 is quite fast as you can see in this benchmark: https://www.intmath.com/cg5/katex-mathjax-comparison.php?processor=MathJax https://www.intmath.com/cg5/katex-mathjax-comparison.php?pro... Still not as fast as KaTeX though.
- qqii 6y agoWow! That's a really impressive difference. My android phone gets ~2700ms for KaTeX, ~3100ms for MathJax 3, ~17000ms for MathJax 2.7. There were times KaTeX and MathJax traded which I'm guessing is due to page size differences and my poor Internet connection.
- vbernat 6y agoKaTeX can also work without JavaScript as the generated code is browser-independent.
- hatmatrix 6y agoThis looks promising, but are there plans to include packages like siunitx or it's meant to be kept simple?