# Time to first plot seems to be much alleviated in 1.4. What happend?

**URL:** <https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340>\
**Category:** General Usage\
**Tags:** question, announcement, plotting, ttfp\
**Created:** [April 10, 2020, 1:41pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340 "2020-04-10T13:41:09Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [April 10, 2020, 1:41pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/1 "2020-04-10T13:41:09Z")

</div>

I read somewhere that time to first plot is now much faster. I tried it on Windows 10 Julia v1.4 and `plot(1:3)` is sub 5 seconds now which is quite acceptable!

I wonder what happened, I haven’t been following as closely the development, so pointers to GitHub posts and discourse posts would be appreciated. If none, then discussion here would be cool.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [April 10, 2020, 1:56pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/2 "2020-04-10T13:56:52Z")

</div>

There wasn’t 1 magic bullet. Inlining heuristics got better, inference had about 6 improvements, `@nospecialize` was added to some code generation. Overall there were about a dozen small improvements that really added up.

---

<div class="post-metadata">

**Author:** ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)\
**Post date:** [April 10, 2020, 2:35pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/3 "2020-04-10T14:35:48Z")

</div>

Yes, there have been several small incremental improvements to compiler performance, and I believe Plots.jl added a bunch of precompile statements that also helped significantly. Even bigger improvements are on the way, for example [use -O1 for code in Plots.jl by JeffBezanson · Pull Request #2544 · JuliaPlots/Plots.jl · GitHub](https://github.com/JuliaPlots/Plots.jl/pull/2544). For me that changed `@time display(plot(rand(10)))` from 19 seconds to 14. We have a couple more improvements still in the pipeline.

---

<div class="post-metadata">

**Author:** ![evanfields](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/evanfields/32/1744_2.png) [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Post date:** [April 10, 2020, 3:58pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/4 "2020-04-10T15:58:39Z")

</div>

Is the improvement just for Plots.jl or across the board? I had heard about time to first plot improvements in 1.4 and was excited to time `using Gadfly`, but found it was actually slightly slower on 1.4 than 1.3. Though I’m not confident my test setup was ideal (open REPL, time `using`, repeat). So I could easily believe there were improvements, I just measured wrong.

---

<div class="post-metadata">

**Author:** ![Oscar\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oscar_smith/32/25343_2.png) [@Oscar\_Smith](https://discourse.julialang.org/u/Oscar_Smith)\
**Post date:** [April 10, 2020, 4:04pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/5 "2020-04-10T16:04:25Z")

</div>

your timing isn’t quite right. `using` might slow down if it does more precompilation. You want to time both `using` and first `plot`

---

<div class="post-metadata">

**Author:** ![jeff.bezanson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeff.bezanson/32/48_2.png) [@jeff.bezanson](https://discourse.julialang.org/u/jeff.bezanson)\
**Post date:** [April 10, 2020, 10:41pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/6 "2020-04-10T22:41:45Z")

</div>

Most of the improvement comes from adding precompile statements to a package, and adding `@optlevel 1` (see linked PR for the exact syntax) to a package. So it’s not really across the board (yet). I highly recommend adding optlevel 1 to any non-performance-critical code. The setting is per-module, so you can group together code that still needs advanced optimizations if necessary.

---

<div class="post-metadata">

**Author:** ![Albert\_Zevelev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/albert_zevelev/32/11844_2.png) [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Post date:** [April 11, 2020, 12:25am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/7 "2020-04-11T00:25:13Z")

</div>

I don’t know much about compilers.  
Suppose I have a Package “A” w/ three functions f1(), f2(), f3().

```nohighlight
@time using A
@time f1()
@time f2()
@time f3()

```

1. What is the difference between the first time I run using A & f1(), f2(), f3()?
2. Is there a trade-off between the first time I run using A & f1(), f2(), f3()?  
If we make using A faster, does that mean the first f1() will be slower?

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [May 27, 2020, 7:08pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/9 "2020-05-27T19:08:15Z")

</div>

“First-plot” isn’t only “much alleviated”, it can be superfast, with gnuplot wrapper:

```julia
$ time ~/julia-1.6.0-DEV-8f512f3f6d/bin/julia -O1 --compile=min --startup-file=no # -e "using Gaston; plot(rand(10))"

julia> @time using Gaston
  0.123084 seconds (54.59 k allocations: 4.599 MiB) # 0.18 sec. in 1.4.0

julia> @time plot(rand(10)) # yes, not using display(plot ...), as showing the time you have to wait, and still it's only 0.39 seconds that way
  0.050220 seconds (28.88 k allocations: 1.764 MiB)

```

Plots.jl got better, in 1.4, for many reasons, even faster in 1.5 (or 1.6) where you get one of the speed-options from above automatically (in some cases `-O0` is ok/better option). I opened an issue for the other, than has given me (for other code) 3.7x faster than default (but it can also be much slower).

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [May 27, 2020, 11:36pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/10 "2020-05-27T23:36:33Z")

</div>

it says gnuplot not available on my system. seems like not packaged perfectly on Windows? let me search and submit an issue.

---

<div class="post-metadata">

**Author:** ![mbaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbaz/32/17295_2.png) [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Post date:** [May 27, 2020, 11:40pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/11 "2020-05-27T23:40:03Z")

</div>

Gaston.jl does not include gnuplot, you need to install it yourself; see [gnuplot - Browse /gnuplot/5.2.8 at SourceForge.net](https://sourceforge.net/projects/gnuplot/files/gnuplot/5.2.8/)

I don’t have the bandwidth right now to figure out how to include gnuplot in Gaston (but pull requests are welcome), and it’s easy enough to install.

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [May 27, 2020, 11:45pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/12 "2020-05-27T23:45:38Z")

</div>

Gotcha. Need to use the new artifacts system I presume? Anyway, for me, this is a kind of friction that stops me from adopting Gaston.jl.

Testing out gnuplot and figuring out that I might need to set up esoteric PATH scares me so it’s way down the list of things to try.

I also get why devs do not have time for it though. Objectively speaking, making it easy to install (so frictionless to adopt) would be the fastest way to increase adoption. But it’s a trade-off between time-vs-desire-for-wider-adoption which may favour time at this stage for the devs.

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [May 28, 2020, 1:00am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/13 "2020-05-28T01:00:22Z")

</div>

Use Linux, it is much easier

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [May 28, 2020, 1:01am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/14 "2020-05-28T01:01:13Z")

</div>

Yeah. Not possible for 99% of ppl working in corporations like banks. insurance.

So that’s keeping out alot of potential users.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 28, 2020, 7:38am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/15 "2020-05-28T07:38:23Z")

</div>

> [@xiaodai](#):
>
> Not possible for 99% of ppl working in corporations like banks. insurance.

I am not sure about this, eg see the banks here:

> **[List of Linux adopters | Businesses and non-profits](https://en.wikipedia.org/wiki/List_of_Linux_adopters#Businesses_and_non-profits)**
>
> Linux is used extensively on servers in businesses, and has been for a long time. Linux is also used in some corporate environments as the desktop platform for their employees, with commercially available solutions including Red Hat Enterprise Linux, SUSE Linux Enterprise Desktop, and Ubuntu.
> 1.Free I.T. Athens, founded in 2005 in Athens, Georgia, United States, is a non-profit organization dedicated to rescuing computers from landfills, recycling them or refurbishing them using Linux exclusivel...

---

<div class="post-metadata">

**Author:** ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Post date:** [May 28, 2020, 7:42am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/16 "2020-05-28T07:42:39Z")

</div>

Eh… Obviously banks use Linux in the IT department for servers etc. By most employees aren’t IT… So yeah… This demonstrates a big problem. A bank is made up of so many users and most are locked down by IT and uses only Windows. I suspect who never worked inside big corporations don’t see that and fail to grasp it.

Only specialist functionsc can use Linux and most data science ppl I know at banks use Windows. So dial down my guesstimate to 90%. 99% is probably too big an exaggeration.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 28, 2020, 8:44am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/17 "2020-05-28T08:44:26Z")

</div>

> [@xiaodai](#):
>
> This demonstrates a big problem. A bank is made up of so many users and most are locked down by IT and uses only Windows. I suspect who never worked inside big corporations don’t see that and fail to grasp it.

I fully grasp it, it is just not _my_ problem. It is a restriction these corporations impose on their own employees. It is within _their_ power to change it.

OS choice is a business decision like any other. Companies should be free to make bad choices, but this should not be anything the FOSS world is concerned with.

While I understand that some people prefer Windows (familiarity), _banning_ qualified people from using Linux or OS/X is like insisting that your employees wear blindfolds and walk backwards on company premises. They will inevitably bump into things and each other, and while it may be mildly amusing, it is not something that anyone else should care about.

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [May 29, 2020, 6:19pm UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/18 "2020-05-29T18:19:41Z")

</div>

It is more about politics. Most IT people know that Linux is much faster and safer but they prefer Windows for corporate use. When something goes wrong, they can blame Microsoft. It is for the same reason that so many banks still use SAS.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 30, 2020, 8:29am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/19 "2020-05-30T08:29:27Z")

</div>

> [@Yifan\_Liu](#):
>
> When something goes wrong, they can blame Microsoft.

I am not sure I understand how that is useful. One can surely _blame_ Microsoft, but this _per se_ does not lead to any tangible benefit (ie bugfixes, free support, or heaven forbid, compensation for damages).

If you are suggesting a principal-agent problem where the employers of IT are clueless and are willing to take “it’s Microsoft’s fault” as an explanation/excuse for any problem, these days that is becoming a caricature of the past at best.

In any case, the target audience of Julia is an expert programmer-scientist with high value added (this includes students who are training to become one). Constraining the choice of OS for such people is like deploying a nuclear submarine in a bathtub.

---

<div class="post-metadata">

**Author:** ![robsmith11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/robsmith11/32/29641_2.png) [@robsmith11](https://discourse.julialang.org/u/robsmith11)\
**Post date:** [May 30, 2020, 8:53am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/20 "2020-05-30T08:53:03Z")

</div>

The expression I usually hear is “no one was ever fired for buying IBM”, i.e., sticking with the mainstream solution is the safe risk-averse career move.

I’d guess that just about anyone using Julia at a bank has enough freedom to also be using Linux. Nearly every quantitative trading and research team I know of uses Linux, typically with a python and C++ stack and maybe Java or kdb+/q mixed in.

---

<div class="post-metadata">

**Author:** ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)\
**Post date:** [May 30, 2020, 9:37am UTC](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340/21 "2020-05-30T09:37:03Z")

</div>

Well regarding using Windows, I build HPC clusters for a living but my desktop is Windows.  
Let us think of WSL 2 - does anyone have experience of this with Julia?

I cannot test sadly as my laptop is at a lower release of Windows which Windows Subsystem for Linux 2 does not support.

[Next page](https://discourse.julialang.org/t/time-to-first-plot-seems-to-be-much-alleviated-in-1-4-what-happend/37340.md?page=2)
