JuliaPy / JuliaPy/PyCall.jl

Precompilation significantly slows Julia startup

Open
#113 10 comments 0 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
1.5k
Forks
186
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.