Skip to content

@inline with traits #79

Open
Open
@timholy

Description

In JuliaArrays/GetindexArrays.jl#3 (comment) I identified an issue in which SimpleTraits caused a nearly 5x performance hit. SimpleTraits was confirmed to be the source because changes like

@@ -414,9 +416,9 @@ StreamIndexStyle(S::StreamingContainer) = StreamIndexStyle(typeof(S))
 
 filter_space_axes(axes::NTuple{N,Axis}, items::NTuple{N,Any}) where {N} =
     _filter_space_axes(axes, items)
-@inline @traitfn _filter_space_axes(axes::Tuple{Ax,Vararg{Any}}, items) where {Ax<:Axis;  TimeAxis{Ax}} =
+@inline _filter_space_axes(axes::Tuple{<:Axis{:time},Vararg{Any}}, items) =
     _filter_space_axes(tail(axes), tail(items))
-@inline @traitfn _filter_space_axes(axes::Tuple{Ax,Vararg{Any}}, items) where {Ax<:Axis; !TimeAxis{Ax}} =
+@inline _filter_space_axes(axes::Tuple{<:Axis,Vararg{Any}}, items) =
     (items[1], _filter_space_axes(tail(axes), tail(items))...)
 _filter_space_axes(::Tuple{}, ::Tuple{}) = ()
 @inline _filter_space_axes(axes::Tuple{Ax,Vararg{Any}}, items) where {Ax<:Axis{:color}} =

to ImageAxes.jl (and several more similar changes) give the faster performance. I assume the problem is that the @inline annotation is not being applied, but I am unsure. I tried swapping the orders of @traitfn and @inline but it didn't seem to help.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions