朱莉娅启动时间慢 [英] Slow Julia Startup Time

查看:90
本文介绍了朱莉娅启动时间慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在探索使用Julia作为通用科学计算语言(与python相反),但是启动时间很慢.

I am exploring using Julia as a general purpose scientific computing language (as opposed to python), but it's startup time is pretty sluggish.

有什么方法可以加快速度吗?

Is there any way of speeding this up?

$ time python -c 'print "Hello"'
Hello

real    0m0.030s
user    0m0.018s
sys 0m0.010s

$ time julia -e 'println("Hello")'
Hello

real    0m4.614s
user    0m4.644s
sys 0m0.116s


附录:此处是去年Julia作家之一的名言.这个策略有困难吗?


ADDENDUM: Here is a quote from one of the Julia authors last year. Was there some difficulty with this strategy?

Julia的大部分内容都是自己编写的,然后进行解析,类型推断和 抓地力,所以从头开始引导整个系统需要一些时间 15-20秒.为了使其更快,我们有一个分阶段的系统 解析,类型推断,然后缓存其序列化版本 sys.ji文件中类型推断的AST.然后加载该文件并 运行julia时用于运行系统.没有LLVM代码或机器 代码被缓存在sys.ji中,因此所有LLVM jitting仍然需要 每次julia启动时都要完成,因此大约需要2 秒.

Most of Julia is written in itself, then parsed, type-inferred and jitted, so bootstrapping the entire system from scratch takes some 15-20 seconds. To make it faster, we have a staged system where we parse, type-infer, and then cache a serialized version of the type-inferred AST in the file sys.ji. This file is then loaded and used to run the system when you run julia. No LLVM code or machine code is cached in sys.ji, however, so all the LLVM jitting still needs to be done every time julia starts up, which therefore takes about 2 seconds.

这2秒钟的启动延迟很烦人,我们有一个计划 修复它.基本计划是能够编译整个Julia 二进制程序:可以运行的可执行文件或.so/.dylib 可以从其他程序中调用的共享库 只是共享的C库.二进制文件的启动时间为 像其他任何C程序一样,因此2秒的启动延迟将消失.

This 2-second startup delay is quite annoying and we have a plan for fixing it. The basic plan is to be able to compile whole Julia programs to binaries: either executables that can be run or .so/.dylib shared libraries that can be called from other programs as though they were simply shared C libraries. The startup time for a binary will be like any other C program, so the 2-second startup delay will vanish.

推荐答案

我在评论中提到的分支现在已经合并,并且julia比以往更加优化了启动(不执行任何操作).

The branch I mentioned in the comment has now been merged and julia is more optimized for startup (and doing nothing), than ever.

$> time julia -e 'println("Hello")'
Hello

real    0m0.622s
user    0m1.013s
sys     0m0.624s

此功能现已在夜间版本中提供,并将包含在下一个0.3版本中.

This is now available in the nightly builds, and will be included in the next 0.3 release.

这篇关于朱莉娅启动时间慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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