Hacker News new | ask | show | jobs
by MisterBiggs 1917 days ago
I've been running the 1.6 release candidates, and the compilation speed improvements have been massive. There have been plenty of instances in the past where I've tried to 'quickly' show off some Julia code, and I end up waiting ~45 seconds for a plot to show or a minute for a Pluto notebook to run, and that's not to mention waiting for my imports to finish. It's still slower than Matlab for the first run, but it's at least in the same ballpark now.
2 comments

In terms of “don’t make me think about why Julia is fast but feels slow for casual use” this release is going to be a game changer.

I just did a “using Plots” in 1.6.0, and it was fast enough to not care about the delta between Plots and, say, R loading ggplot.

Huge kudos to the Julia team.

I agree, this is a game changer. Previously time to first plot (TTFP) was >1 minute for me, which made julia completely unusable for my day-to-day exploratory data analysis, visualisation, quick random number experiments etc. Now TTFP is less than 10 seconds. I'm now ready (and excited) to jump ship from R and python!
That was also a huge problem for me. I sometimes open Stata/R/Python/Excel, run a few snippets, and I'm done.

All four take seconds to start (or even less), and Julia felt like a huge step back in productivity.

If it's really fixed, might be good trying again.

Admittedly not a huge dataset but the TTFP is significantly shorter. :P

       _       _ _(_)_     |  Documentation: https://docs.julialang.org
      (_)     | (_) (_)    |
       _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
      | | | | | | |/ _` |  |
      | | |_| | | | (_| |  |  Version 1.6.0 (2021-03-24)
     _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
    |__/                   |
    
    (@v1.6) pkg> add Plots
        Updating registry at `~/.julia/registries/General`
        Updating git-repo `https://github.com/JuliaRegistries/General.git`
       Resolving package versions...
       Installed Qt_jll ─ v5.15.2+3
      Downloaded artifact: Qt
        Updating `~/.julia/environments/v1.6/Project.toml`
      [91a5bcdd] + Plots v1.11.0
        Updating `~/.julia/environments/v1.6/Manifest.toml`
      [ede63266] ↑ Qt_jll v5.15.2+2 ⇒ v5.15.2+3
      Progress [========================================>]  246/246
    246 dependencies successfully precompiled in 140 seconds
    
    julia> @time using Plots
      3.689727 seconds (6.58 M allocations: 472.965 MiB, 7.49% gc time, 0.13% compilation time)
    
    julia> @time begin
           using Plots
           x = 1:10; y = rand(10); # These are the plotting data
           plot(x, y)
           end
      3.050765 seconds (3.63 M allocations: 218.824 MiB, 4.87% gc time, 59.07% compilation time)
    
    julia> @time begin
           using Plots
           x = 1:10; y = rand(10); # These are the plotting data
           plot(x, y)
           end
      0.001435 seconds (2.61 k allocations: 161.836 KiB)
What kind of speed do you see now?
No idea if this is really a fair comparison but just to get a brief idea of current speeds:

   julia> @time let
          using Plots
          plot([sin, cos])
          end
        11.267558 seconds (17.98 M allocations: 1.114 GiB, 4.83% gc time)
Versus Matlab which probably takes about 15 seconds just to open the editor but plotting is very fast.

   >> tic
   fplot( @(x) [sin(x) cos(x)])
   toc
   Elapsed time is 0.374394 seconds.
Julia is just about as fast as Matlab after the first run for plotting.
I wonder how much Julia could be helped with some uneval/image-saving magic. So when you run the repl you instead get a pre-built binary with plot already loaded and several common specialisations already compiled.
We call these "system images" and you can generate them with PackageCompiler [0]. Unfortunately, it's still a little cumbersome to create them, but this is something that we're improving from release to release. One possible future is where an environment can be "baked", such that when you start Julia pointing to that environment (via `--project`) it loads all the packages more or less instantaneously.

The downside is that generating system images can be quite slow, so we're still working on ways to generate them incrementally. In any case, if you're inspired to work on this kind of stuff, it's definitely something the entire community is interested in!

[0] https://github.com/JuliaLang/PackageCompiler.jl

Easy, you only have to add a handful of „battery included“ packages to the default system image.

That however means that some packages get a preferred status in the Julia ecosystem.

> Matlab which probably takes about 15 seconds just to open the editor

Try this:

matlab -nosplash -nodesktop -r "tic; fplot( @(x) [sin(x) cos(x)]); toc"

This took 25 seconds on my laptop (15 seconds the second time, when the filesystem was warm).
I believe that's still not going to capture the startup time of Matlab itself, right?
It's faster than opening the editor, though.
I’ve also been running the release candidates, and I get something like 6 seconds to first plot on my 2013 laptop, including the time for `using Plots` and the time to actually draw the first plot. A huge improvement; kudos to the developers.