-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Performance issue with poly! #4367
Comments
Huh, this could have multiple issues, but it might be an issue with an inefficiency in Shapefile.jl (what version of Shapefile.jl are you running?). Consider this addendum to your code: julia> @time gb_geoms = GeoMakie.to_multipoly(countries2)
2.376218 seconds (4.12 M allocations: 139.941 MiB, 0.69% gc time)
julia> @time p1 = poly!(ax1, gb_geoms; color = :transparent, strokewidth = 1, strokecolor = :blue)
0.223099 seconds (103.81 k allocations: 66.597 MiB, 2.04% gc time, 24.87% compilation time) Also, you should pass With GeoIO the conversion of Shapefile.jl geometry to Meshes.jl geometry is eager, with Shapefile+GeoInterface it's lazy, only converting in |
On #4319 I'm getting: fig = nothing; fig = Figure(size = (900,900))
ax1 = Axis(fig[1,1])
@time p2 = poly!(ax1, countries2; color=(:blue,0.0), strokewidth = 0.75, overdraw = true)
0.421756 seconds (4.01 M allocations: 909.210 MiB, 9.01% gc time) So maybe something that the refactor is fixing, even if it has gotten more memory hungry. (I guess
Yes, you are setting the mesh color to transparent blue. You should set After hunting down performance problems in merge(meshes): @time p2 = poly!(ax1, countries2; color=(:blue,0.0), strokewidth = 0.75, overdraw = true)
0.200260 seconds (1.39 M allocations: 111.060 MiB) |
JuliaGeometry/GeometryBasics.jl@5491a72 This is the other major source of allocations. With the runtime type, Julia ends up allocating for every point here, I believe. With a function barrier that goes away. There should be more cases like this across the other interface methods, but maybe that's something the GeoInterface people should look into. I think these issues would also go away if you had something like After this change: @time p2 = poly!(ax1, countries2; color=(:blue,0.0), strokewidth = 0.75, overdraw = true)
0.124739 seconds (15.11 k allocations: 67.517 MiB) |
There's a proposal for that method in GeoInterface JuliaGeo/GeoInterface.jl#128, we should probably get around to writing that... |
Using the current version of Makie and Shapefile, still on Julia 1.10.5:
So, the situation is as in @asinghvi17 's comment, and using (I came back to this after getting a crash in my backup solution, GeoIO + Meshes: viz!
|
]st -m Makie
)Makie v0.21.10 on Julia 1.10.5
]activate --temp; add Makie
)not tried yet, but I did do a full
] update
Windows 11, Intel and NVIDIA graphics (issue appears with both)
Today I tried to move from the use of GeoIO.jl + Meshes.viz! to draw a shapefile, to Shapefile.jl and Makie's own
poly!
The former method had a very similar latency inducing bug earlier which was fixed last May: https://discourse.julialang.org/t/visualization-of-shapefile-meshes-jl-viz-very-slow
It turns out that using
poly!
is taking more than 3 seconds and makes my Observables (toggles, menus, clicks, zooms etc) very laggy right from the start, to the point of crashing (see below).For now I will keep using my previous method, but I wanted to report this issue.
shapefile.zip
Additionally, the latter shows black contours instead of blue, but I may be doing it wrong.
An error of the renderloop resulting from
poly!
:The text was updated successfully, but these errors were encountered: