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 Chairmarks
import GeometryOps as GO, GeoInterface as GI
function_area(p::GI.LinearRing)
first_point = p.geom[1]
area =0.0for next_point inview(p.geom, 2:length(p.geom))
area += first_point[1] * next_point[2] - first_point[2] * next_point[1]
first_point = next_point
endreturn area
end_area(p::GI.Polygon) =iflength(p.geom) ==1_area(p.geom[1])
else_area(p.geom[1]) -sum(_area, view(p.geom, 2:length(p.geom)))
end
p = GI.Polygon([GI.LinearRing([(0, 0), (0,1), (1, 1), (1, 0), (0, 0)])])
@be GO.area($p) # ~6 ns@be_area($p) # ~7 ns# These two are at least equivalent - showing that `apply` and `applyreduce` are indeed cost-free.@be GO.area($([p, p])) # ~17 ns, 1 allocation@besum($_area, $([p, p])) # ~15 ns, no allocations# So there is work to do here.
We need to isolate and remove this allocation!
The text was updated successfully, but these errors were encountered:
We need to isolate and remove this allocation!
The text was updated successfully, but these errors were encountered: