January 2020
Intermediate to advanced
532 pages
13h 31m
English
It is easy and straightforward to construct a struct of arrays. After all, we were able to quickly do that for a single field earlier. For completeness, this is how we can design a new data type for storing the same trip payment data in a column-oriented format. The following code shows that this pattern helps to improve performance:
struct TripPaymentColumnarData vendor_id::Vector{Int} tpep_pickup_datetime::Vector{String} tpep_dropoff_datetime::Vector{String} passenger_count::Vector{Int} trip_distance::Vector{Float64} fare_amount::Vector{Float64} extra::Vector{Float64} mta_tax::Vector{Float64} tip_amount::Vector{Float64} tolls_amount::Vector{Float64} improvement_surcharge::Vector{Float64} total_amount::Vector{Float64} ...Read now
Unlock full access