Issue 1:
Pulling #28356 (comment) out to a new issue since this second example doesn't seem to be exactly the same as the previous fix. In this case, a code which compiles a function call in the global scope is okay, but when the same function call is compiled in a local scope then compilation hangs. Using a recent nightly with the fix for #28356

_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?" for help, "]?" for Pkg help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.7.0-rc1.18 (2018-08-02 13:13 UTC)
_/ |\__'_|_|_|\__'_| | Commit 34b0dd097f (0 days old master)
|__/ | x86_64-w64-mingw32

I run the code:

using DiffEqBiological, StochasticDiffEq

model = @reaction_network rn begin
(d,1000), X ↔ 0
end d

i = 1.0
prob = SDEProblem(model,[1000.0+i],(0.,200.),[i])
sol = solve(prob, EM(), dt = 0.01)

for i in [1., 2., 3., 4., 5.]
prob = SDEProblem(model,[1000.0+i],(0.,200.),[i])
sol = solve(prob, EM(), dt = 0.01)
end

and it's just fine. However, when I do not allow it to compile the solve call in the global scope first, it hangs at compilation.

using DiffEqBiological, StochasticDiffEq

model = @reaction_network rn begin
(d,1000), X ↔ 0
end d

for i in [1., 2., 3., 4., 5.]
prob = SDEProblem(model,[1000.0+i],(0.,200.),[i])
sol = solve(prob, EM(), dt = 0.01)
end

Given my working knowledge of the Julia compiler, both solve calls are compiling the same thing so 🤷‍♂️ I don't get it.

Note that the example from #28356 displayed some of this behavior too, since the original example only ran into the issue when the function integrator(...) was involved. If you refactor it so that way it does the same commands in the REPL, then even before the #28356 fix there was no issue. Given @JeffBezanson 's comments about how the hang was due to inference generating unions, my guess is that somehow a difference in inference could be involved, but I'm of course not the expert on this so that could be totally wrong.

Issue 2:
How the heck does anyone get anything done in Julia 0.6.2 on 64-bit linux (ubuntu 16.04). It takes 22 seconds to load the plotting package Gadfly ??? It's not precompilation time, since it happens even after the package has been precompiled once. If I restart Julia, I still have to wait, sometimes even longer the second time.

# julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> tic(); using Gadfly; toc()
elapsed time: 22.640510854 seconds
22.640510854

julia> [ctl-D to exit]
# julia
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: https://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.6.2 (2017-12-13 18:08 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu

julia> tic(); using Gadfly; toc()
elapsed time: 28.402201721 seconds
28.402201721

julia>