JuliaPy / JuliaPy/PyCall.jl

Precompilation significantly slows Julia startup

オープン
#113 コメント 10 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Julia
スター
1.5k
フォーク
186
PR マージ指標
30日以内にマージされた PR はありません

説明

Julia startup time with PyCall precompiled into base/userimg.jl jumps in commit d19995c5fd895aa6a249cb6b6d1164dc2826e8f2 from <1 second to ~10 seconds on several of my machines (with both Julia 0.3.6 and some 0.4 masters).

I found this with a git bisect using a quick and dirty script:

``` bash
#!/bin/bash
# GOOD PyCall: 896f82a
# BAD PyCall: ebe352f

JIFILE=/tmp/test_bisect
julia /home/jason/src/julia/contrib/build_sysimg.jl $JIFILE native /tmp/userimg.jl --force > /dev/null

T1=`date +%s`
/bin/time -f %U julia -J ${JIFILE}.ji -E "0"
TIME=$(echo `date +%s`-$T1 | bc -l)
echo $TIME

if [[ `echo "$TIME>2" | bc -l` -eq 1 ]]; then
echo "Long"
exit 1
else
echo "Short"
exit 0
fi
```

I'm not actually sure if this is a problem with PyCall or Julia, so if the latter, then let me know and I'll move the bug up the stack.

I don't know enough about PyCall to debug this further, but I did do some macro level debugging in [this mailing list thread](https://groups.google.com/forum/#!topic/julia-dev/uvEgky_QKmY). At the time I did not know that it was from PyCall specifically.

Oh, and another gotcha: the slow start seems to be dependent on stdout. Let me show you what I mean:

``` julia
$ /bin/time -f %U julia -J /tmp/test_newgit.ji -E 0 # slow start
0
9.03
$ julia -J /tmp/test_newgit.ji -E 0 >/dev/null # fast start
0.63
$ julia -J /tmp/test_newgit.ji -e 0 # fast start
0.59
$ julia -J /tmp/test_newgit.ji -e "println(3)" # slow start
3
9.40
```

Whereas with a commit before d19995c5fd895aa6a249cb6b6d1164dc2826e8f2 (precompiled), all of these would be fast.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start with the reported regression commits d19995c5fd895aa6a249cb6b6d1164dc2826e8f2, 896f82a, and ebe352f, then inspect contrib/build_sysimg.jl and reproduce the timing with the supplied bash script. Compare startup with stdout redirected and with different expressions, and use the linked mailing-list investigation to isolate whether PyCall or Julia causes the slowdown. Done means identifying the regression and restoring fast precompiled startup.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
bash, julia, python
領域
performance
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
32/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。