Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase delay between blocks of typesetting to improve responsiveness #17

Closed
dpvc opened this issue Nov 9, 2010 · 4 comments
Closed

Comments

@dpvc
Copy link
Member

dpvc commented Nov 9, 2010

It might be worth trying out a longer delay between spurts of typesetting to see if that improves the browser's responsiveness during the typesetting phase. This may make the typesetting take longer, since there will be longer delays during the process, but currently the responsiveness is pretty bad. Not sure if it will really help, because when the typesetting os a single equation gets to be long enough, there isn't much we can do to be responsive while that is going on.

Davide

@shogun70
Copy link
Contributor

shogun70 commented Nov 9, 2010

Is testing this simply a matter of skipping typesetting, running pre-processing, then finding each equation and manually processing them according to some programmable schedule?

@dpvc
Copy link
Member Author

dpvc commented Nov 9, 2010

No, it is easier than that. In MathJax.js, lines 1386 and 1387 are

 if (new Date().getTime() - start > this.processUpdateTime && i < scripts.length)
   {start = 0; this.RestartAfter(MathJax.Callback.Delay(1))}

which are what cause MathJax to pause briefly to allow the screen to update (to show newly typeset equations or respond to user interaction). This happens when the typesetting time has exceeded a threshold given by processUpdateTime (half a second by default). This batches together screen updates when the equations are able to processed quickly (which helped with the IE8 problems when I added a similar feature to jsMath), but still allows an incremental update of the mathematics in the page.

We should look into changing Delay(1) to be a longer time, and need to test what that should really be (e.g., Delay(10), Delay(100) or whatever) consistent with allowing some responsiveness while not making the typesetting process excessively longer.

Davide

@dpvc
Copy link
Member Author

dpvc commented Nov 9, 2010

Well, I did some tests, and it looks like changing both the delay and the processUpdateTime may be the solution to responsiveness. The delay actually seemed to have little effect, but cutting processUpdateTime by half gave a noticable improvement in response to user interaction during typesetting. I'm not sure if there is any advantage to increasing the delay or not.

@dpvc
Copy link
Member Author

dpvc commented Nov 9, 2010

OOPS, forgot I had started this issue already, so I started another. This is handled in the code submitted in issue #20, so I'm closing this issue.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants