Skip to content

Commit

Permalink
Random discovery: make intial math rendering twice faster :-)
Browse files Browse the repository at this point in the history
On a math-heavy 100K doc, speeds up "All math rendered" from 38s to 18s!

#68, cben/CodeMirror-MathJax#14

I was doing early hookMath() and postponing renderAllMath() on the theory
"Queuing this allows text to appear before math."
But doing hookMath() before firepad load already renders all math,
and renderAllMath() does all the work again because there is no caching
(cben/CodeMirror-MathJax#15).
  • Loading branch information
cben committed Jun 4, 2015
1 parent 740dcfa commit 19afe78
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions mathdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ function setupEditor(editor) {
updateTitle();
}
});

CodeMirror.hookMath(editor, MathJax);
}

// Firepad
Expand Down Expand Up @@ -219,6 +217,7 @@ function setupFirepad(editor, firepad) {

// Queuing this allows text to appear before math.
MathJax.Hub.Queue(function() {
CodeMirror.hookMath(editor, MathJax);
editor.renderAllMath();
});
});
Expand Down

0 comments on commit 19afe78

Please sign in to comment.