Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

On my machine the first link loaded in under a second. On my mobile it was about 3 seconds, but it didn't feel especially sluggish. Even then, I'd say stackexchange has a somewhat inefficient implementation, in that they're trying to render everything in one shot.

For example, I see no reason why they wouldn't just render the stuff that's in view first, and the rest is rendered incrementally as the user scrolls, or a few seconds after the initial paint.

I take your point that KaTeX is faster in absolute terms, but from a usability point of view, the benefits do not outweigh the costs in my opinion.



> the first link loaded in under a second. On my mobile it was about 3 seconds

Did you wait for the typefaces to change to Computer Modern? On my smartphone, this took ages, and that is what I implied by 'fully loaded'; more complex maths is unreadable on some devices with only the native typefaces. Even a (relatively straightforward) cube root doesn't look clean[0].

MathJax has (from my observation) two 'levels' of rendering, where it uses the OS native typeface for a first pass, and then renders everything in Computer Modern for a uniform look (except on Apple devices, which somehow override this with STIX fonts).

Needless to say, the typeface change means that the dimensions of the maths content change, causing the rest of the website to reflow a second time. This second render takes the bulk of the time, and having a website's content unexpectedly jump around a long while after it has (apparently) loaded is not exactly user-friendly.

[0]: https://imgur.com/a/CrKqeI5


I wonder about your setup. On an iPhone 12 on residential wifi behind a VPN, I noticed no lag, delayed rendering, or weird rendering issues.


I can confirm that MathJax is very slow, especially if you render complex math including graphs (all in view). The Google Lighthouse Benchmark gave me a very bad performance score, but as soon as I switched to Katex my statically rendered blog gets 95-100 points for performance.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: