Curious if anyone sees any major differences in practical usage for these packages.
StructArrays can use struct of arrays or array of structs approach.
TypedTables uses namedtuple of arrays and constructs the array of named tuples on the fly.
But, under-the-hood both packages are using NamedTuples.
TypedTables has provided some nicer display overrides to create prettier output. Also provides some additional convenience macros.
Interestingly, under the hood both packages create almost the same type for the data structure. This example is a simple table of one column of Int and a second column of Float64:
TypedTable:
Table{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}}
StructArrays using a constructor of arrays:
StructVector{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}, Int64} (alias for StructArray{NamedTuple{(:a, :b), Tuple{Int64, Float64}}, 1, NamedTuple{(:a, :b), Tuple{Array{Int64, 1}, Array{Float64, 1}}}, Int64})
StructArrays using a constructor with a predefined struct:
StructVector{v, NamedTuple{(:a, :b), Tuple{Vector{Int64}, Vector{Float64}}}, Int64} (alias for StructArray{v, 1, NamedTuple{(:a, :b), Tuple{Array{Int64, 1}, Array{Float64, 1}}}, Int64})
that predefined struct:
struct v
a::Int
b::Float64
end
Basically, very little difference except that StructArrays makes the types a bit more verbose because it includes the alias type. But, starting with a struct the StructArrays can use that as the shorthand for the types of the elements. Also, TypedTables uses a â1â to (I am guessing) to indicate that the index value for the vectors is an Int while StructArrays uses Int64 to explicitly show the index type.
Performance for getting and setting seems to be identical. Both packages advantage column semantics over row semantics with the same issues for updating values in a row (must replace a row, NOT update an element of a row).
Both support the Tables.jl interfaces.
The only significant difference seems to be that TypedTables adds a bit more functionality to work as an âapplicationâ, while StructArrays might do a bit more to work as infrastructureâbut thatâs not clear.
Seems like the packages could be merged into TypedTables, which has a bit more functionality, with the possibility to share the maintenance work and have the Union of capabilities in a single package. This is a philosophical thing about saving some work and reducing duplication of effortâbut YMMV, and itâs no big deal to have both.