On 1.6, if you add this diff to Gaston.jl:
diff --git a/src/Gaston.jl b/src/Gaston.jl
index 2731d24..c7ccb7b 100644
--- a/src/Gaston.jl
+++ b/src/Gaston.jl
@@ -91,4 +91,7 @@ function __init__()
return nothing
end
+@assert precompile(plot, (UnitRange{Int},))
+@assert precompile(display, (Figure,))
+
end
then you shave about 0.4s off TTFP (note juliamns
is an alias for julia-master --startup-file=no
):
tim@diva:~/.julia/dev/Gaston$ juliamns -q -e 'using Gaston'
tim@diva:~/.julia/dev/Gaston$ juliamns -q
julia> @time (using Gaston; display(plot(1:10)))
1.617487 seconds (3.32 M allocations: 230.368 MiB, 2.88% gc time)
julia>
tim@diva:~/.julia/dev/Gaston$ git stash
Saved working directory and index state WIP on master: eed6704 Update stable documentation link
tim@diva:~/.julia/dev/Gaston$ juliamns -q -e 'using Gaston'
tim@diva:~/.julia/dev/Gaston$ juliamns -q
julia> @time (using Gaston; display(plot(1:10)))
2.123158 seconds (6.28 M allocations: 399.833 MiB, 4.39% gc time)
But now put those precompile
statements inside a conditional (to circumvent #29859):
diff --git a/src/Gaston.jl b/src/Gaston.jl
index 2731d24..457a463 100644
--- a/src/Gaston.jl
+++ b/src/Gaston.jl
@@ -91,4 +91,9 @@ function __init__()
return nothing
end
+if VERSION >= v"1.4.2"
+ @assert precompile(plot, (UnitRange{Int},))
+ @assert precompile(display, (Figure,))
+end
+
end
and you get no benefit:
tim@diva:~/.julia/dev/Gaston$ juliamns -q -e 'using Gaston'
tim@diva:~/.julia/dev/Gaston$ juliamns -q
julia> @time (using Gaston; display(plot(1:10)))
2.126315 seconds (6.28 M allocations: 399.802 MiB, 4.27% gc time)
julia> VERSION >= v"1.4.2"
true
And it really seems to be the version-check: this diff
diff --git a/src/Gaston.jl b/src/Gaston.jl
index 2731d24..4dc30fe 100644
--- a/src/Gaston.jl
+++ b/src/Gaston.jl
@@ -91,4 +91,12 @@ function __init__()
return nothing
end
+function _precompile_()
+ ccall(:jl_generating_output, Cint, ()) == 1 || return nothing
+ # VERSION >= v"1.4.2" || return nothing
+ @assert precompile(plot, (UnitRange{Int},))
+ @assert precompile(display, (Figure,))
+end
+_precompile_()
+
end
works fine until you uncomment the VERSION check. It fails to deliver a benefit even if you put it in @static
.
CC @daschw @aminya
While precompiling, VERSION
is v"1.0.2"
for me... Put a @show VERSION
at toplevel... Wat?
:open_mouth: I get the same version.
It is set at the top of the file!!!!
https://github.com/mbaz/Gaston.jl/blob/eed6704ac5faefb5e178aa7d0fa4376705a7e11e/src/Gaston.jl#L20
Oh my god that is funny...took me like a minute to stop laughing. How could I not have thought to check that?
I would be lying if I said I didn't re-build julia a couple of times with various @show VERSION
in version.jl
, grepping through the julia source code after 1.0.2
etc...
LOL! Seriously, sorry for causing such confusion guys! I'll make sure to change that variable name in the next release.
That is a totally reasonable variable name to use as long as it's not exported. You just need to use Base.VERSION
within your package.
Yes, I think we all know. But apparently it is quite easy to mess up while doing so.
I'm just recommand against breaking the package API because of this.
Either way, no worries @mbaz: as of today, 1.0.2 is my new favorite number!
I used @static
checks in SnoopCompileBot. That should be different.
No, it was just a namespace problem.
Most helpful comment
It is set at the top of the file!!!!
https://github.com/mbaz/Gaston.jl/blob/eed6704ac5faefb5e178aa7d0fa4376705a7e11e/src/Gaston.jl#L20