Skip to content

Incremental math rendering #19

Closed
Closed

Description

@cben

The initial render on document load is horribly unacceptably slow (saw 1 minute on a math-heavy page).
The unrendered text does show very fast (#15) but it's not very useful since the editor is paralyzed until all math is rendered.

Activity

  1. cben commented on Oct 23, 2013

    @cben
    OwnerAuthor

    Verified that loading MathJax from the network is not the blocker; it's the rendering itself.

  2. cben commented on Oct 23, 2013

    @cben
    OwnerAuthor

    Pasting same text into http://cben.github.io/CodeMirror-MathJax/demo.html typesets much faster (~10s instead of ~60s).
    Sounds like using CM of fixed size helps a lot.
    Alternatively it could be caused by Firepad?

  3. cben commented on Oct 29, 2013

    @cben
    OwnerAuthor

    Some rough measurements on a heavy doc:

    • scanning text for the regexp is nearly free (~0.1s)
    • typesetting without markText is not bad - 8s, much of which is due to loading mathjax extensions (=> Cache list of needed mathjax extensions in firebase #21).
      • same with markText without replacedWith! invisible markers are nearly free.
    • everything is at least 2× slower due to logging with an open JS console.
    • full typesetting takes 62s.
      • Chrome profiling suggests a lot of time is spent in visibleLines, (via endOperation←updateDisplay←markText).
        Indeed text gradually shifts vertically as math is typeset. => Should try keeping view/cursor on top instead of bottom.
        Naive attempts to wrap with cm.operation don't help because post-Typeset callbacks come one by one.
    • tried an incremental approach => 61s. no loss, no gain. Still makes editor barely responsive.
      I guess CM's input polling doesn't get much chance to run.
  4. cben commented on Nov 22, 2013

    @cben
    OwnerAuthor

    Migrated to mathdown, where it belongs. The mathdown-specific part is #24 and maybe #21.

  5. added a commit that references this issue on Apr 30, 2015
    1ba8bb6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions