Skip to content

Commit ddee198

Browse files
committed
Improved performance of coordinate name lookup.
1 parent 567683b commit ddee198

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/defaults.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ const default_coord_names = (:X, :Y, :Z, :M)
99
coordnames(::AbstractGeometryTrait, geom) = default_coord_names[1:ncoord(geom)]
1010

1111
# Maybe hardcode dimension order? At least for X and Y?
12-
x(::AbstractPointTrait, geom) = getcoord(geom, findfirst(x -> x === :X, coordnames(geom)))
13-
y(::AbstractPointTrait, geom) = getcoord(geom, findfirst(x -> x === :Y, coordnames(geom)))
14-
z(::AbstractPointTrait, geom) = getcoord(geom, findfirst(x -> x === :Z, coordnames(geom)))
15-
m(::AbstractPointTrait, geom) = getcoord(geom, findfirst(x -> x === :M, coordnames(geom)))
12+
x(::AbstractPointTrait, geom) = getcoord(geom, findfirst(isequal(:X), coordnames(geom)))
13+
y(::AbstractPointTrait, geom) = getcoord(geom, findfirst(isequal(:Y), coordnames(geom)))
14+
z(::AbstractPointTrait, geom) = getcoord(geom, findfirst(isequal(:Z), coordnames(geom)))
15+
m(::AbstractPointTrait, geom) = getcoord(geom, findfirst(isequal(:M), coordnames(geom)))
1616

1717
is3d(::AbstractPointTrait, geom) = :Z in coordnames(geom)
1818
ismeasured(::AbstractPointTrait, geom) = :M in coordnames(geom)

0 commit comments

Comments
 (0)