performance - Julia 包在第一次运行时加载速度非常慢

标签 performance package julia

我在 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和 friend 在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)

最佳答案

当提到 时,此问题通常称为延迟或首次绘图时间 (TTFP)。 julia-lang .在使用这些关键字时,您可以找到一些讨论。
文章 "Analyzing sources of compiler latency in Julia: method invalidations" 中评估了最近对该问题的一个很好的分析。
在撰写本文时(2020 年底,稳定版本 v1.5.3),没有可用的通用解决方案,但讨论了大规模预编译包而不是 JIT 的策略,取得了微不足道的成功。

关于performance - Julia 包在第一次运行时加载速度非常慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64584575/

相关文章:

performance - 解释语言: The higher-level the faster?

java - 在 Eclipse AVD 中,我得到了 'Unfortunately ~ has stopped working'

optimization - 如何告诉LLVM可以优化远距仓储?

python - 使用 Julia NetCDF.jl 包将值附加到 netCDF4 变量

css - 增加 LightTable (Juno) 中控制台窗口的大小

javascript - Firebase 存储数据最佳实践

javascript - node.js:嵌套for循环,字符串操作性能惨淡

go - go语言获取函数的包名

c - 我是否只是证明了埃拉托色尼筛法的效率低于试验划分?

java test - 打包一个java应用程序以在另一个linux机器上运行