【发布时间】:2020-10-29 03:28:21
【问题描述】:
我在 Linux 5.4.0 下使用 Julia 1.5.2 并等待了大约 15 分钟 Pkg.add("DifferentialEquations")。然后我在 Jupyter Notebook 中启动内核并运行以下代码。执行需要 1 分钟(实际上我第一次执行此操作需要 225 秒)。
t = time()
using Printf
using BenchmarkTools
using OrdinaryDiffEq
using Plots
tt = time() - t
@sprintf("It took %f seconds to import Printf, BenchmarkTools, OrdinaryDiffEq and Plots.", tt)
# It took 58.545894 seconds to import Printf, BenchmarkTools, OrdinaryDiffEq and Plots.
最后,我做了与上面相同的操作,但针对每个包。这是摘要:
Printf: 0.004755973815917969
BenchmarkTools: 0.06729602813720703
Plots: 19.99405598640442
OrdinaryDiffEq: 19.001102209091187
我从here 知道Pkg 过去很慢,但我认为 15 分钟根本不是正常的安装时间。不过,这不是我的大问题。
我知道 Julia 需要在每次启动内核或加载某些包时编译所有内容。但这显然不是编译时间,而是编译永恒。
谁能弄清楚为什么这非常慢?而且,如果正常的话,给Pkg提供预编译的包不是更好,比如numpy和朋友都是Python的吗?或者至少在第一个using 中永远编译?
谢谢!
我的完整平台信息:
Julia Version 1.5.2
Commit 539f3ce943 (2020-09-23 23:17 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
【问题讨论】:
-
你能在每晚的构建中试试这个吗?它应该更快(我猜总共需要 15 秒)
-
另外,你有机械硬盘还是固态硬盘?即使对于 1.5,这些时间似乎也很慢。
-
@OscarSmith,我一会儿试试,谢谢。
-
@OscarSmith 我有一个 SSD(根本不是最快的,但可以接受)。
-
@OscarSmith,它将 Plots 的加载时间减少到大约 6.2 秒。再次感谢您。
标签: performance package julia