KaTeX vs MathJax (svg)

JavaScript performance comparison

Revision 27 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="http://cdn.mathjax.org/mathjax/latest/MathJax.js?&delayStartupUntil=configured"></script>

<script>
MathJax.Hub.Config({skipStartupTypeset: true,
  jax: ["input/TeX","output/HTML-CSS"],
  extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"],
  TeX: {
    extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
  }
});
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="http://cdn.mathjax.org/mathjax/latest/MathJax.js?&delayStartupUntil=configured"></script> <script> MathJax.Hub.Config({skipStartupTypeset: true, jax: ["input/TeX","output/HTML-CSS"], extensions: ["tex2jax.js","MathMenu.js","MathZoom.js"], TeX: { extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"] } }); 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