# 是否有办法减轻浏览器中大量MathJax方程的压力？

**URL:** <https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647>\
**Category:** Support\
**Tags:** math\
**Created:** [2023年一月19日 02:08 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647 "2023-01-19T02:08:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiasummer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xiasummer/32/82790_2.png) [@xiasummer](https://meta.discourse.org/u/xiasummer)\
**Post date:** [2023年一月19日 02:08 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/1 "2023-01-19T02:08:29Z")

</div>

### 有没有办法减轻浏览器处理大量 MathJax 方程的压力？

您好，我正在 Discourse 中进行数学内容的撰写，其中包含许多方程。感谢这个插件，它在我的 Discourse 中运行得非常好。

但是，随着我的文章越来越长，大约有 30 个方程，浏览器似乎在超负荷工作，我的电脑风扇在呼呼作响，网页的响应速度明显变慢，按下键盘上的任何按钮都需要很长时间才能看到反应。

所以我认为这一定是由于我使用了太多的方程，但我的数学方程是不可忽略的 😂 ，我不能删除它们中的大部分。

所以我想知道，我们是否可以有一个模式，其中数学方程插件 MathJax 不会立即工作，它可以每 10 秒解析一次方程，或者只在我上传完回复后才解析。或者我们可以设置一个自动切换，如果回复中的方程少于 10 个，MathJax 将立即工作，否则它将勉强工作？

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [2023年一月19日 02:54 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/2 "2023-01-19T02:54:29Z")

</div>

我正在与 @joffreyjaffeux 讨论改进此插件的可能方法，我认为我们目前的计划也有助于提高性能。

---

<div class="post-metadata">

**Author:** ![danekhollas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danekhollas/32/79637_2.png) [@danekhollas](https://meta.discourse.org/u/danekhollas)\
**Post date:** [2023年一月19日 12:40 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/3 "2023-01-19T12:40:14Z")

</div>

您是否尝试过将 MathJax 切换到 KaTeX？（在插件设置中）它应该会快得多。

---

<div class="post-metadata">

**Author:** ![xiasummer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xiasummer/32/82790_2.png) [@xiasummer](https://meta.discourse.org/u/xiasummer)\
**Post date:** [2023年二月1日 02:54 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/4 "2023-02-01T02:54:26Z")

</div>

上次我使用Katex时，有人告诉我MathJax比KaTex快得多 🤣

所以，我想知道你是否有证明，哪一个更快、更健壮？

---

<div class="post-metadata">

**Author:** ![mcmcclur](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcmcclur/32/115456_2.png) [@mcmcclur](https://meta.discourse.org/u/mcmcclur)\
**Post date:** [2023年二月1日 03:22 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/5 "2023-02-01T03:22:28Z")

</div>

> [@xiasummer](#):
>
> 有人告诉我 MathJax 比 KaTex 快得多

他们可能在谈论 MathJax 3.3 版本，该版本在某些情况下确实比 KaTeX 快。但是，Math 插件使用的是 MathJax V2.7，这通常比 KaTeX 慢得多。

可能更重要的是，与 KaTeX 相比，所有版本的 MathJax 都具有更丰富的功能。如果切换到 KaTeX，您将失去 MathJax 提供的上下文菜单，这对我很重要。MathJax 还提供多种输入（TeX、AsciiMath、MathML）和输出（HTML、SVG）形式。

@Falco 我认为改进插件的正确方法是将 MathJax 版本升级到最新的 3 版本。不过，我认为这并不容易，因为 API 发生了重大变化。从好的方面来看，我认为新 API 有了很大的改进，尽管尚未得到充分记录。

---

<div class="post-metadata">

**Author:** ![xiasummer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/xiasummer/32/82790_2.png) [@xiasummer](https://meta.discourse.org/u/xiasummer)\
**Post date:** [2023年二月27日 08:50 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/6 "2023-02-27T08:50:51Z")

</div>

## 我想我找到办法了！

只需关闭预览窗口，压力就会大大降低，而且效果很好。

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/2/f/42fb74e91680c6fb871c1745fc51effbf7e51a14.png)

如果您想检查预览，可以打开一会儿然后立即关闭。

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2023年三月29日 08:51 UTC](https://meta.discourse.org/t/is-there-a-way-to-relieve-the-pressure-on-the-browser-with-many-mathjax-equations/253647/7 "2023-03-29T08:51:46Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
