Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Second plot speed #133

Open
PallHaraldsson opened this issue Apr 16, 2020 · 3 comments
Open

Second plot speed #133

PallHaraldsson opened this issue Apr 16, 2020 · 3 comments

Comments

@PallHaraldsson
Copy link

PallHaraldsson commented Apr 16, 2020

FYI: Second plot speed is much better as expected (with fewer allocations), but only third plot has fewest allocations, and expected speed.

I wouldn't say this is an "issue", just an observation on non-master. I've only heard of "first-plot issues". I wander about the reason and if it applies to other (plotting) packages and master here. I've always relied on benchmarking code after running ONCE. It may not be about your package, rather julia (1.5)?

julia> @time using Gaston
  0.644211 seconds (1.04 M allocations: 53.019 MiB, 1.17% gc time)

julia> @time plot(randn(10^6),randn(10^6))
  0.377701 seconds (144.02 k allocations: 22.743 MiB, 1.71% gc time)

julia> @time plot(randn(10^6),randn(10^6))
  0.179409 seconds (53.69 k allocations: 17.984 MiB, 4.22% gc time)

julia> @time plot(randn(10^6),randn(10^6))
  0.047522 seconds (33 allocations: 15.261 MiB, 3.09% gc time)

julia> @time plot(randn(10^6),randn(10^6))
  0.043855 seconds (33 allocations: 15.261 MiB, 3.35% gc time)

It seems I ruled out issue with Julia itself or @time.

@mbaz
Copy link
Owner

mbaz commented Apr 16, 2020

@PallHaraldsson That's interesting behavior; I woud have expected the third and subsequent plots to take the same time as the second.

There are some performance-related changes on my local master branch that might affect this. After I release 0.11 (should be a few days now), I'll run some profiling and try to figure out what is going on.

The good thing is that even the first plot is very fast!

@gcalderone
Copy link

Is it possible that plot(randn(10^6),randn(10^6)) simply sends the commands to gnuplot, but do not wait for it to be completed?

On my computer I get consistent results with display(plot(randn(10^6),randn(10^6))).

@mbaz
Copy link
Owner

mbaz commented Apr 19, 2020

@gcalderone I need to look at this in more depth (after I manage to get the next release out). However, I think I'm waiting until gnuplot finishes plotting. Gaston tells gnuplot to print a message on stderr as the last step of a plot command, and does not return until it gets the message back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants