Re: [C++] Recommended way to extract values from scalars

2024-02-22 Thread Aldrin
This may be too late, but here's a simple example of iterating over a ChunkedArray containing primitive (fixed-width) types [1]. This mainly differs from Felipe's code because it goes from an arrow::Array to a C array without going through ArraySpan or ArrayData (which are needed if you want to

Re: [C++] Recommended way to extract values from scalars

2024-02-22 Thread Weston Pace
>> ultimately, these do end up being loops at the lower levels (unless there's some hardware support, eg SIMD/GPU etc). > Even if you don't write explicit SIMD, (1) the compiler might > vectorize the loop for you, and (2) the superscalar nature of modern > CPUs means loops with less branches and

Re: [C++] Recommended way to extract values from scalars

2024-02-22 Thread Felipe Oliveira Carvalho
> these do end up being loops at the lower levels Even if you don't write explicit SIMD, (1) the compiler might vectorize the loop for you, and (2) the superscalar nature of modern CPUs means loops with less branches and memory indirections will run faster. > Now I just need to figure out the

Re: [C++] Recommended way to extract values from scalars

2024-02-22 Thread Blair Azzopardi
Thanks @Weston and @Felipe. This information has been very helpful and thank you for the examples too. I completely agree with vectorizing computations; although, ultimately, these do end up being loops at the lower levels (unless there's some hardware support, eg SIMD/GPU etc). @Weston, I