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
Plotting 2000x2000 image is slow. A large amount of allocations is created. #1412
Comments
Extra motivation: in python the imshow takes 0.04 seconds, 4 times faster. Not acceptable!
|
So, the creation of plots isn't fully optimized in Makie yet, since it hasn't been as important yet. Note, that if you want to update/animate a plot use: x = rand(2000, 2000)
figure, ax, plot = heatmap(x)
plot[1] = rand(2000, 2000) Which should be pretty fast... Although I just see it's around figure, ax, plot_obj = heatmap(x, colorrange=(0, 1))
x = rand(2000, 2000)
@time plot_obj[1] = x; That seems like calculating the extrema from the matrix is surprisingly slow (0.005137s... sounds fair maybe?)... |
No display of figure@SimonDanisch I tried your update/animation suggestion I indeed get 0.006 in 75% of the cases, and 0.015 in 25% of cases. It is a lot better than my 0.15 seconds, thanks for this solution.
DisplayIf I display the figure, I get significantly higher runtimes, 0.01 to 0.25 seconds. 0.25 seconds in 25% of cases looks like a lot. Displaying figures seem to be very slow.
Display in REPL vs GPUWhen I display a single 2000x2000 image in the REPL, the GPU stays close to 100% most of the time. To me this looks like an over-use of GPU. Too high update frequency? |
You could actually try using your own renderloop: Create a function like this one https://github.com/JuliaPlots/Makie.jl/blob/master/GLMakie/src/rendering.jl#L17=, GLMakie.set_window_config!(renderloop=your_renderloop) |
With #2336 we now have an on demand renderloop as the default! |
I have started to use GLMakie more intensively and noticed it is slow for the images I use. Bellow you can find a sample code.
heatmap, plot, image all takes about 0.15 seconds per call, and I have about 10 images to show, so this leads to 1.5 seconds, quite a lot. You can notice the amount of allocations per call:
1.00 M allocations: 50.724 MiB
. Looks like each value of the 2000x2000 image is copied and allocated into something else. This can be done in a more optimal way, a single allocation for all the values at once. I am currently debugging the issue, any hint is welcome.The text was updated successfully, but these errors were encountered: