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

display fixes #3057

Merged
merged 5 commits into from
Jul 11, 2023
Merged

display fixes #3057

merged 5 commits into from
Jul 11, 2023

Conversation

SimonDanisch
Copy link
Member

@SimonDanisch SimonDanisch commented Jul 10, 2023

So, GLMakie not opening a window with activated Plotpane really was not a great idea...
Lots of complaints, and I also tripped over this quite a bit.
This PR changes this back to opening a window by default for GLMakie!
But this means, that one now needs to call GLMakie.activate!(inline=true) to get GLMakie back into the plotpane.

This PR also changes a few other things:

  • can_show_inline(backend) was weirdly buggy with VSCode, a.k.a most of the time it worked that e.g. WGLMakie would show in the plotpane if the plotpane is enabled, but sometimes it just stopped working...Not sure why, but looking at the VSCode code, it should never work the way can_show_inline is implemented (not checking for MIME"juliavscode/html") - but it definitely worked correctly most of the time 🤷
  • now one can do display(plot; inline=false) to force a window even if inline is true. Of course this doesn't work the other way around, since VSCode somehow doesn't get into the show path anymore with calling display(fig; inline=true) directly... Not sure why...

@MakieBot
Copy link
Collaborator

MakieBot commented Jul 10, 2023

Compile Times benchmark

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running:

using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(display(fig))
using create display create display
GLMakie 10.73s (10.65, 10.79) 0.06+- 1.04s (1.03, 1.06) 0.01+- 769.22ms (756.80, 821.44) 23.52+- 9.88ms (9.79, 9.94) 0.05+- 86.53ms (85.50, 89.03) 1.16+-
master 10.73s (10.58, 10.82) 0.08+- 1.04s (1.03, 1.05) 0.01+- 763.55ms (753.46, 776.05) 7.54+- 9.93ms (9.83, 10.03) 0.07+- 85.87ms (84.85, 86.79) 0.62+-
evaluation -0.02%, -0.0s invariant (-0.04d, 0.94p, 0.07std) +0.38%, 0.0s invariant (0.31d, 0.58p, 0.01std) +0.74%, 5.67ms invariant (0.32d, 0.56p, 15.53std) -0.56%, -0.06ms invariant (-0.90d, 0.12p, 0.06std) +0.75%, 0.65ms invariant (0.70d, 0.22p, 0.89std)
CairoMakie 12.41s (12.18, 12.64) 0.16+- 1.44s (1.43, 1.46) 0.01+- 274.49ms (271.44, 281.47) 3.69+- 12.63ms (12.42, 12.83) 0.13+- 7.06ms (6.99, 7.24) 0.09+-
master 12.43s (12.14, 12.79) 0.24+- 1.44s (1.43, 1.46) 0.01+- 272.32ms (270.43, 275.21) 1.83+- 12.58ms (12.44, 12.87) 0.14+- 7.06ms (6.94, 7.13) 0.08+-
evaluation -0.14%, -0.02s invariant (-0.08d, 0.88p, 0.20std) +0.00%, 0.0s invariant (0.00d, 1.00p, 0.01std) +0.79%, 2.17ms invariant (0.75d, 0.20p, 2.76std) +0.38%, 0.05ms invariant (0.35d, 0.52p, 0.13std) +0.13%, 0.01ms invariant (0.10d, 0.85p, 0.09std)
WGLMakie 13.12s (12.65, 13.33) 0.28+- 1.36s (1.29, 1.43) 0.05+- 11.82s (11.51, 12.15) 0.20+- 15.71ms (13.82, 23.07) 3.28+- 1.22s (1.11, 1.46) 0.12+-
master 13.21s (12.72, 13.61) 0.29+- 1.39s (1.31, 1.49) 0.07+- 11.86s (11.47, 12.53) 0.33+- 15.01ms (13.92, 16.15) 0.90+- 1.30s (1.13, 1.46) 0.15+-
evaluation -0.67%, -0.09s invariant (-0.31d, 0.57p, 0.28std) -2.53%, -0.03s invariant (-0.59d, 0.30p, 0.06std) -0.39%, -0.05s invariant (-0.17d, 0.76p, 0.26std) +4.45%, 0.7ms invariant (0.29d, 0.60p, 2.09std) -6.11%, -0.07s noisy🤷‍♀️ (-0.57d, 0.31p, 0.13std)

@jkrumbiegel
Copy link
Member

What about changing display(plot; inline=false) to display(plot; window = true) instead? I never found inline that clear to be honest. Although, does opening an os window or a browser tab count as a "window"? At least, if I think about it, the default in Julia is to display however the display stack is currently configured. If I instead always want to force a window, shouldn't that be positively affirmed using a true option instead of negating the opposite?

We could also think about having a slightly more "convenient" syntax for opening new windows with this. Instead of window = true one could maybe pass window = :new or so. Just a suggestion. But I felt so far users didn't find the display(GLMakie.Screen(), fig) super intuitive.

@ffreyer
Copy link
Collaborator

ffreyer commented Jul 10, 2023

I would also suggest adding inline as a theme argument to make it more accessible. display feels kind of niche to me in Makie and it also only applies to this one figure.

@SimonDanisch
Copy link
Member Author

Yeah I think those are good ideas, but right now I just want to make a small bug fix PR.
We can target bigger API changes in the beta 0.20 branch!
The display(fig; inline=true) thing is basically also just a bug fix, considering that I intended all activate! kwargs to be usable in display too.

@SimonDanisch SimonDanisch merged commit 89dffb3 into master Jul 11, 2023
13 checks passed
@SimonDanisch SimonDanisch deleted the sd/display-fixes branch July 11, 2023 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants