BITNP / BIThesis

📖 北京理工大学非官方 LaTeX 模板集合,包含本科、研究生毕业设计模板及更多。🎉 (更多文档请访问 wiki 和 release 中的手册)
https://bithesis.bitnp.net
LaTeX Project Public License v1.3c
684 stars 97 forks source link

Overleaf超时 #543

Open yangpuhai opened 1 month ago

yangpuhai commented 1 month ago

发生了什么?

旧版本(yang yating等维护)在免费版本的Overleaf上可以正常完成编译。 而新版本(2024年推出,由Feng Kaiyu等维护)在Overleaf上内容较多(10万字,150+参考文献)时会造成超时,需要开通Overleaf会员才能完成编译,给学生带来了巨大困难。

你期望的结果

希望新版本可以适当改进以实现在内容较多时也可以在免费版本的Overleaf上完成编译

BIThesis 模板

graduate-thesis

YDX-2147483647 commented 1 month ago

之前有同学反映 www.overleaf.com 换成 cn.overleaf.com 就行,有没有试过呢?

yangpuhai commented 1 month ago

之前有同学反映 www.overleaf.com 换成 cn.overleaf.com 就行,有没有试过呢?

感谢帮助,尝试了一下,还是出现了超时的情况。目前,我已经采用了Ruifeng Ma等同学在Overleaf上发布的新模板Beijing Institute of Technology (BIT) 2024 version thesis template(源于yang yating等维护的旧版本),该版本可以正常编译。

YDX-2147483647 commented 1 month ago

好的。请问是 https://www.overleaf.com/latex/templates/beijing-institute-of-technology-bit-2024-version-thesis-template/bxjqynnmbjtk 吗?

yangpuhai commented 1 month ago

好的。请问是 https://www.overleaf.com/latex/templates/beijing-institute-of-technology-bit-2024-version-thesis-template/bxjqynnmbjtk 吗?

是的

YDX-2147483647 commented 1 month ago

刚刚做了个十一万字的测试用例,还没有暴露问题。我之后加\cite试一下。

另:Beijing Institute of Technology (BIT) 2024 version thesis template - Overleafhttps://github.com/RuifMaxx/LaTeX-template 并不完全相同,Overleaf上的BIT-thesis-grd.cls似乎有更多刻意改动。


更新:加了十几个参考文献就会出现超时,但“从头开始重新编译”就不超了。

fky2015 commented 1 month ago

texpage https://www.texpage.com/pricing 提供了每次一分钟的免费编译时长。

fky2015 commented 1 month ago

减小包的依赖可能是唯一一个优化性能的手段。

YDX-2147483647 commented 1 month ago

texpage texpage.com/pricing 提供了每次一分钟的免费编译时长。

刚刚我在 #536 补充了一下各家情况。


更新: https://github.com/joaomlourenco/novathesis/blob/05f1a6fe2f2c4f3270ebee00fc54d15286b40b87/README.md?plain=1#L142-L146

WARNING: Overleaf reduced the compile time image There is no way you can compile your thesis/dissertation (using this template) within the new (20 seconds) time limit. This means you have two options:

YDX-2147483647 commented 1 month ago

result

benchmark.zip

Details ```shell # 首先各自完整编译一遍,生成 *.aux 等 $ arara main-ctex.tex (XeLaTeX) XeLaTeX engine ................................ SUCCESS (Biber) The Biber reference management software ......... SUCCESS (XeLaTeX) XeLaTeX engine ................................ SUCCESS (XeLaTeX) XeLaTeX engine ................................ SUCCESS (XDVIPDFMX) The XDVIPDFMX program ....................... SUCCESS Total: 20.484 seconds $ arara main-bithesis.tex (XeLaTeX) XeLaTeX engine ................................ SUCCESS (Biber) The Biber reference management software ......... SUCCESS (XeLaTeX) XeLaTeX engine ................................ SUCCESS (XeLaTeX) XeLaTeX engine ................................ SUCCESS (XDVIPDFMX) The XDVIPDFMX program ....................... SUCCESS Total: 26.893 seconds # 然后比较 xelatex 编译时间 $ hyperfine 'xelatex -no-pdf main-ctex.tex' 'xelatex -no-pdf main-bithesis.tex' Benchmark 1: xelatex -no-pdf main-ctex.tex Time (mean ± σ): 5.357 s ± 0.614 s [User: 4.228 s, System: 1.055 s] Range (min … max): 4.512 s … 6.415 s 10 runs Benchmark 2: xelatex -no-pdf main-bithesis.tex Time (mean ± σ): 7.626 s ± 0.287 s [User: 6.235 s, System: 1.333 s] Range (min … max): 7.249 s … 8.246 s 10 runs Summary xelatex -no-pdf main-ctex.tex ran 1.42 ± 0.17 times faster than xelatex -no-pdf main-bithesis.tex ``` 空文档(只保留`\begin{document}\end{document}`)的结果如下。 ``` Benchmark 1: xelatex -no-pdf main-ctex.tex Time (mean ± σ): 857.7 ms ± 54.1 ms [User: 730.3 ms, System: 101.2 ms] Range (min … max): 776.5 ms … 949.0 ms 10 runs Benchmark 2: xelatex -no-pdf main-bithesis.tex Time (mean ± σ): 1.904 s ± 0.289 s [User: 1.554 s, System: 0.328 s] Range (min … max): 1.590 s … 2.296 s 10 runs Summary xelatex -no-pdf main-ctex.tex ran 2.22 ± 0.36 times faster than xelatex -no-pdf main-bithesis.tex ``` 再加上 biblatex 等宏包,结果如下。 ``` Benchmark 1: xelatex -no-pdf main-ctex.tex Time (mean ± σ): 2.181 s ± 0.275 s [User: 1.933 s, System: 0.209 s] Range (min … max): 1.696 s … 2.396 s 10 runs Benchmark 2: xelatex -no-pdf main-bithesis.tex Time (mean ± σ): 3.659 s ± 0.124 s [User: 3.196 s, System: 0.422 s] Range (min … max): 3.473 s … 3.874 s 10 runs Summary xelatex -no-pdf main-ctex.tex ran 1.68 ± 0.22 times faster than xelatex -no-pdf main-bithesis.tex ``` 继续加上`\frontmatter`等,只保留`% \input{./chapters/*.tex}`,结果如下。 ``` Benchmark 1: xelatex -no-pdf main-ctex.tex Time (mean ± σ): 1.995 s ± 0.348 s [User: 1.782 s, System: 0.193 s] Range (min … max): 1.624 s … 2.504 s 10 runs Benchmark 2: xelatex -no-pdf main-bithesis.tex Time (mean ± σ): 3.779 s ± 0.185 s [User: 3.284 s, System: 0.432 s] Range (min … max): 3.580 s … 4.203 s 10 runs Summary xelatex -no-pdf main-ctex.tex ran 1.89 ± 0.34 times faster than xelatex -no-pdf main-bithesis.tex ``` ```python import marimo __generated_with = "0.7.11" app = marimo.App(width="medium") @app.cell def __(): import numpy as np return np, @app.cell def __(): from matplotlib.pyplot import subplots fig, ax = subplots(layout='constrained') return ax, fig, subplots @app.cell def __(): tests = ["empty", "packages", "packages + hooks", "full"] return tests, @app.cell def __(np): data = { "ctex": np.array( [ [0.8577, 54.1e-3], [2.181, 0.2], [1.995, 0.348], [5.357, 0.614], ] ), "bithesis": np.array( [ [1.904, 0.289], [3.659, 0.124], [3.779, 0.185], [7.626, 0.287], ] ), } return data, @app.cell def __(ax, data, fig, tests): for k,v in data.items(): ax.errorbar(x=tests, y=v[:,0], yerr=v[:,1], label=k) ax.legend() ax.grid(visible=True) ax.set_ylabel('时间 / s') fig return k, v if __name__ == "__main__": app.run() ```
YDX-2147483647 commented 1 month ago

完整测试

result-3

一些特殊情况:

现象:

Details ```python import marimo __generated_with = "0.7.11" app = marimo.App(width="medium") @app.cell def __(): import numpy as np return np, @app.cell def __(): from matplotlib.pyplot import subplots fig, ax = subplots(layout='constrained') return ax, fig, subplots @app.cell def __(): tests = ["empty", "packages", "packages + hooks", "full"] return tests, @app.cell def __(np): data = { "ctex + biblatex": np.array( [ [0.8577, 54.1e-3], [2.181, 0.2], [1.995, 0.348], [5.357, 0.614], ] ), "bithesis (biblatex)": np.array( [ [1.904, 0.289], [3.659, 0.124], [3.779, 0.185], [7.626, 0.287], ] ), "ctex + natbib": np.array( [ [886.6e-3, 74.7e-3], [884.1e-3, 35.4e-3], [931.0e-3, 57.0e-3], [3.371, 0.276], ] ), "BIT-thesis-grd (natbib)": np.array( [ [2.234, 0.388], [2.046, 0.330], [2.274, 0.447], [5.294, 0.418], ] ), } return data, @app.cell def __(ax, data, fig, tests): for k, v in data.items(): ax.errorbar( x=tests, y=v[:, 0], yerr=v[:, 1], label=k, linestyle="-." if "natbib" in k else "-", capsize=5., ) ax.legend() ax.grid(visible=True) ax.set_ylabel("时间 / s") ax.set_ylim([0, None]) fig return k, v if __name__ == "__main__": app.run() ```

biblatex - Why is biber so slow? - TeX - LaTeX Stack Exchange

YDX-2147483647 commented 2 weeks ago

减小包的依赖可能是唯一一个优化性能的手段。

像这种\clist_item其实每编译一页都运行了一遍,如果改改,应该可以总共只运行一遍。(肯定是从 O(n) 变成 O(1),但实际效果我就不清楚了。)

https://github.com/BITNP/BIThesis/blob/424e5b851df44d42cbf26900874480b5de58484a/bithesis.dtx#L837-L840

https://github.com/BITNP/BIThesis/issues/548#issuecomment-2310585967

fky2015 commented 2 weeks ago

减小包的依赖可能是唯一一个优化性能的手段。

像这种\clist_item其实每编译一页都运行了一遍,如果改改,应该可以总共只运行一遍。(肯定是从 O(n) 变成 O(1),但实际效果我就不清楚了。)

https://github.com/BITNP/BIThesis/blob/424e5b851df44d42cbf26900874480b5de58484a/bithesis.dtx#L837-L840

#548 (comment)

不过因为这个 list 非常小,性能提升肯定不明显。