KaTeX vs MathJax

JavaScript performance comparison

Revision 37 of this test case created by

Preparation code

<link href="http://xymostech.com/katex/katex.min.css" rel="stylesheet" type="text/css">
<link href="http://xymostech.com/katex/fonts/fonts.css" rel="stylesheet" type="text/css">
<script src="http://xymostech.com/katex/katex.min.js"></script>
 <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script>

<script>
MathJax.Hub.Config({skipStartupTypeset: true});
MathJax.Hub.Configured();
</script>

<div id="math"></div>
      
<script>
Benchmark.prototype.setup = function() {
  var math = document.getElementById("math");
  var formula = "\\dfrac{-b \\pm \\sqrt{b^2 - 4ac}}{2a}";

};

Benchmark.prototype.teardown = function() {
  math.innerHTML = "";

};
</script>

Preparation code output

<link href="http://xymostech.com/katex/katex.min.css" rel="stylesheet" type="text/css"> <link href="http://xymostech.com/katex/fonts/fonts.css" rel="stylesheet" type="text/css"> <script src='https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML'></script> <script> MathJax.Hub.Config({skipStartupTypeset: true}); MathJax.Hub.Configured(); </script> <div id="math"></div>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
KaTeX
katex.process(formula, math);
math.outerWidth;
pending…
MathJax
// async test
math.innerHTML = "<script type='math/tex'>" + formula + "</script>";
MathJax.Hub.Queue(["Process", MathJax.Hub, math]);
MathJax.Hub.Queue(function() {
  math.outerWidth;
  deferred.resolve();
});
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL.

0 Comments