(no title)
romeovs | 3 years ago
Too bad they're not using KaTeX [0] instead.
It renders the maths server-side, so there's no runtime needed.
An additional bonus is that the resulting math is copy-pasteable, which in the case of disply math might not be that useful (since most equations are to complex to be meaningfully copy-pasted with unicode), but it helps from inline math dissappearing when copy pasting texts.
But, that being said, I'm sure they had their reasons to do so. For one, MathJax seems more well-known by quite a bit so maybe it's the safer option.
osrec|3 years ago
By offloading the rendering to the client, you make use of the spare capacity that exists on most client machines today, with no noticable slowdown for the user (it may even end up doing the "first paint" faster in the browser if GitHub are careful about their implementation).
Even with my SaaS product, we try and do as much work on the client as possible to reduce our server requirements. If you're sensible about it, users don't even notice.
delta_p_delta_x|3 years ago
Have you visited math.stackexchange? Pop by their MathJax reference page[0], and observe how long all the mathematical notation takes to render fully—it takes at least six seconds on my recent notebook, plugged in. On my 2018 iPad Pro, it takes well over thirty seconds on the first page load (drops to ~5 s on subsequent visits: there's probably some caching going on).
Here's[1] a benchmark comparing KaTeX (server-side), MathJax 2.7, and MathJax 3.0 (apparently a complete rewrite supporting server-side rendering[2], but it's still noticeably slower than KaTeX).
MathJax is really slow (slower still than LaTeX itself, and that's saying something).
[0]: https://math.meta.stackexchange.com/questions/5020/mathjax-b...
[1]: https://www.intmath.com/cg5/katex-mathjax-comparison.php
[2]: https://docs.mathjax.org/en/latest/upgrading/whats-new-3.0.h...
lelandfe|3 years ago
You're right on the money with the server costs though.
muhehe|3 years ago
I don't know what your SAAS does (maybe it's not really applicable here), but in the case of github, it's very wastefull. Yes, it would take some work, some servers, etc but they have the skill, the money and everything they need to do it. They could do it once (well, with every change, but it's not very often) on their side instead every client on every pageview will have to do the same work again and again, wasting time and energy.
civilized|3 years ago
Gelitio|3 years ago
Why?
Because markdown files seldom change and probably read much more often.
Anyway I would not agree that it is a good idea to move everything to client just because you can. There are always up and downsides.
I think your comment is too generic.
xigoi|3 years ago
joppy|3 years ago
Original page (compressed): 10 kB
Page with server-rendered Katex (compressed): 50 kB
Katex.js (compressed): 80 kB
So after two pages it’s a net win to not render the mathematics server-side.
dllu|3 years ago
mk12|3 years ago
williamstein|3 years ago
fastball|3 years ago
I don't think I'd qualify an issue from the end of last year as "unfixed for a long time".
runarberg|3 years ago
mk12|3 years ago
jscholes|3 years ago
They do, accessibility being one of them. Rendering math in the way you describe makes it difficult, or impossible, to understand for all sorts of audiences, including those relying on screen reading software.
j-james|3 years ago
https://github.com/KaTeX/KaTeX/issues/38
sytse|3 years ago
powersnail|3 years ago
ThinBold|3 years ago
qumpis|3 years ago
barnabee|3 years ago
xigoi|3 years ago