I found a very neat way to speed up MathJax execution times and I thought about sharing it with everyone here. Typically whenever I start my browser I have to load up all of these MathJax resources from the Cloudflare CDN when I first visit math.stackexchange.com:

enter image description here

As you can see this takes quiet a while (> 40s) on my connection here in Mumbai, and it's not the only request that will be made to Cloudflare's CDN as it will also load up other MathJax assets (like the fraktur or chalkboard fonts when needed).

Fortunately there's this addon called LocalCDN that works exactly as its name suggests: It blocks those requests to CDNs and loads up those resources locally, hence making loading up those MathJax requests almost instantaneous.

enter image description here

Not only is this better for speed (especially on that poor 4G network that my mobile phone uses with that addon installed on Firefox Nightly, bonus I get to save some Mbs of bandwidth as well and I cannot stress how much my mobile 4G browsing experience has improved since I adopted that addon) but it also protects your privacy from those spooky "free" CDNs. It will also help users for whom certain CDNs are blocked like Chinese users for whom ajax.googleapis.com is blocked and end up with an unusable website.

The addon is free and completely open source (there's even an auditing script to verify the integrity of the bundled resources) and I would encourage everyone to give it a try. Anyway hope at least someone will find this useful.

After using it for only 2 weeks these are my stats:

enter image description here

  • 10
    $\begingroup$ It is strange that your browser is not caching these resources automatically. When I look at the corresponding information in Chrome DevTools, the Size column says (disk cache) or (memory cache) for almost all items; very little is fetched from cloudflare. Are you sure that you have not inadvertently disabled caching? $\endgroup$ Oct 10 at 16:30
  • $\begingroup$ I wouldn't call this "super easy" to install on an Android phone. The workaround required to install unauthorized extensions takes some technical ability. $\endgroup$ Oct 15 at 10:00
  • $\begingroup$ @NeilStrickland That's why I said "when I first visit", I purge cookies and all local data with each browser session for privacy reasons. $\endgroup$
    – user153330
    Oct 20 at 5:24

You must log in to answer this question.

Browse other questions tagged .