Julia程序包在首次运行时加载速度非常慢 [英] Julia package load extremely slow in first run

查看:288
本文介绍了Julia程序包在首次运行时加载速度非常慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Linux 5.4.0下使用Julia 1.5.2,并等待了大约15分钟以获取Pkg.add("DifferentialEquations").然后,我在Jupyter Notebook中启动了内核,并运行了以下代码.花了1分钟的时间才能完成(实际上,我第一次执行此操作需要225秒).

I'm using Julia 1.5.2 under Linux 5.4.0 and waited around 15 minutes for Pkg.add("DifferentialEquations"). Then I started the Kernel in Jupyter Notebook and ran the following code. It took terribly 1 minute to execute (the actual first time that I did this it took 225s).

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.

最后,我完成了与上面相同的操作,但是对于每个程序包.这是摘要:

Finally, I done the same as above, but for each package. This is the summary:

Printf:           0.004755973815917969
BenchmarkTools:   0.06729602813720703
Plots:            19.99405598640442
OrdinaryDiffEq:   19.001102209091187

我从此处知道,Pkg过去运行缓慢,但是我认为15分钟根本不是正常的安装时间.但是,这不是我的大问题.

I know from here that Pkg was slow in the past, but I think that 15 minutes isn't a normal installing time at all. However, this is not my big problem.

我知道Julia每次启动内核或加载某些软件包时都需要编译所有内容.但这显然不是编译时间,而是编译的永恒.

I know that Julia needs to compile everything everytime the Kernel is started or some package is loaded. But it obviously is not a compilation time, it's a compilation eternity.

有人能弄清楚为什么这么慢吗?而且,如果这是正常的话,向Pkg提供预编译的软件包(例如numpy)会更好吗,而朋友是使用Python的?还是至少在第一个using中永久编译?

Can anyone figure out why this is so terribly slow? And, if it's normal, wouldn't it be better to provide precompiled packages to Pkg such as numpy and friends are in Python? Or at least compile forever in the first 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)

推荐答案

此问题在引用 julia时通常称为 latency 绘制时间 -lang .使用这些关键字时,您可以找到一些讨论.

This problem is generally called latency or time-to-plot when referring to julia-lang. There are some discussions you can find when using these keywords.

在文章>分析编译器的来源中评估了对该问题的最新分析. Julia中的延迟:方法无效"

在撰写本文时(2020年末,稳定版本v1.5.3),尚无通用解决方案,但已讨论了对软件包进行大规模预编译而不是JIT的策略,但收效甚微.

At the time of writing (end 2020, stable release v1.5.3), no general solution is available but strategies of massive precompilation of packages instead of JIT is discussed, with marginal success.

这篇关于Julia程序包在首次运行时加载速度非常慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆