You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using Extents, GADM, Chairmarks
import GeometryOps as GO
switzerland = GI.geometry(GI.getfeature(GADM.get("CHE"), 1)) |> GO.tuples
Result
julia> @be GO.prepare_naturally($(switzerland.geom[1]))
Benchmark: 17 samples with 1 evaluation
min 74.916 μs (29 allocs: 1.349 MiB)
median 143.375 μs (29 allocs: 1.349 MiB)
mean 12.350 ms (29.24 allocs: 1.349 MiB, 11.73% gc time)
max 149.128 ms (33 allocs: 1.349 MiB, 99.86% gc time)
julia> @be GI.extent($(switzerland.geom[1].geom[1].geom |> GI.LinearRing); fallback =true)
Benchmark: 416 samples with 1 evaluation
min 200.292 μs
median 207.834 μs
mean 225.360 μs
max 384.791 μs
This means that creating a natural tree which allocates etc. is 1.3x faster than gettting the extent which is pretty insane. We should try to fix this somehow, because that means that any geometry without cached extent is getting clobbered in benchmarks.
Ah it calls getpoint directly, it's not recursive. Maybe that's the speed difference? It also goes over the iterator thrice, once per dimension, which is...not the greatest of ideas (IMO)
Activity
rafaqz commentedon Oct 12, 2025
Sounds like you need to profile;)
Very likely the new julia version has introduced type instability?
asinghvi17 commentedon Oct 13, 2025
With type instability I would expect allocations though, but yeah will have to profile and see what's going on.
I think the mapreduce changes made it into 1.12, that may be a part of it
evetion commentedon Jan 4, 2026
Seems to be mapreduce yes.
edit: But I see the same performance on 1.11 though
asinghvi17 commentedon Jan 4, 2026
Ah it calls
getpointdirectly, it's not recursive. Maybe that's the speed difference? It also goes over the iterator thrice, once per dimension, which is...not the greatest of ideas (IMO)GeoInterface.jl/src/fallbacks.jl
Line 134 in 5a85ddc
asinghvi17 commentedon Jan 4, 2026
Ok so this is a bit long BUT it gets runtime down by nearly 8x while allocating a bit more