Skip to content

Sorting based on types #48

Description

@Larbino1

This example here shows how the order of types in can vary. In theory, the order of the tuple could be kept consistent, so that less types are created and less recompilation needs to be done.

julia> t1 = TypeSortedCollection(Any[1, 1.0])
TypeSortedCollection{Tuple{Vector{Int64}, Vector{Float64}}, 2}(([1], [1.0]), ([1], [2]))
julia> t2 = TypeSortedCollection(Any[1.0, 1])
TypeSortedCollection{Tuple{Vector{Float64}, Vector{Int64}}, 2}(([1.0], [1]), ([1], [2]))
julia> typeof(t1)
TypeSortedCollection{Tuple{Vector{Int64}, Vector{Float64}}, 2}
julia> typeof(t2)
TypeSortedCollection{Tuple{Vector{Float64}, Vector{Int64}}, 2}                                                                                                                                                                                                                                                                

I see you already have the preserve_order option, so this could be done without needing a major version change?

I wonder if you have any thoughts on how to decide the ordering, perhaps objectid on the types. Is there a better option?

Activity

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

Metadata

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