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
How do I access allocation free AND flexible a TypedTable?
Nevermind the way quicker access at the NamedTuple.
using TypedTables
using BenchmarkTools
y = (a=1:1_000,)
x =Table(y)
v =zeros(eltype(getproperty(x,:a)),100)
#this fixes the column statically to label :afunctionaccess_table!(v,x)
for i in1:length(x)
v[i%length(v)+1] +=getproperty(x,:a)[i]
endend@btimeaccess_table!($v,$x)
@btimeaccess_table!($v,$y)
functionaccess_table2!(v,x;label=:a)
for i in1:length(x)
v[i%length(v)+1] +=getproperty(x,label)[i]
endend@btimeaccess_table2!($v,$x)
@btimeaccess_table2!($v,$y)
functionaccess_table3!(v,x::TypedTables.Table;label=:a)
n =getproperty(columns(x),label)
for i in1:length(x)
v[i%length(v)+1] +=#= getproperty(x,label) =#n[i]
endend@btimeaccess_table3!($v,$x)
5.633 μs (2 allocations: 64 bytes)
The text was updated successfully, but these errors were encountered:
Got it...
Can there be done sth to help improve access natively? This does not sound like a job for AcceleratedArrays.jl, but I might be wrong.
using TypedTables
using BenchmarkTools
y = (a=1:1_000,)
x =Table(y)
v =zeros(eltype(getproperty(x,:a)),100)
functionaccess_table!(v,x)
for i in1:length(x)
v[i%length(v)+1] +=getproperty(x,:a)[i]
endend@btimeaccess_table!($v,$x)
@btimeaccess_table!($v,$y)
functionaccess_table3!(v,x::NamedTuple;label=:a)
for i in1:length(x)
v[i%length(v)+1] +=getproperty(x,label)[i]
endendfunctionaccess_table3!(v,x::TypedTables.Table;label=:a)
z =columns(x)
returnaccess_table3!(v,z,label=label)
end@btimeaccess_table3!($v,$x)
@btimeaccess_table3!($v,$y)
How do I access allocation free AND flexible a TypedTable?
Nevermind the way quicker access at the NamedTuple.
5.093 μs (0 allocations: 0 bytes)
4.200 ns (0 allocations: 0 bytes)
51.871 μs (2000 allocations: 62.50 KiB)
3.800 ns (0 allocations: 0 bytes)
5.633 μs (2 allocations: 64 bytes)
The text was updated successfully, but these errors were encountered: