Picking the right tools
The Arrow compute libraries provide an extremely easy-to-use interface, but what about performance? Do they exist just for ease of use? Let’s try it out and compare!
Adding a constant value to an array
For our first test, let’s try adding a constant value to a sample array we construct. It doesn’t need to be anything extravagant, so we can create a simple 32-bit integer Arrow array and then add 2
to each element and create a new array. We’re going to create arrays of various sizes and then see how long it takes to add a constant value of 2
to the Arrow array using different methods.
Remember!
Semantically, an Arrow array is supposed to be immutable, so adding a constant produces a new array. This property of immutability is often used to create optimizations and reusability of memory depending on the particular Arrow implementation. While it is possible to potentially achieve greater performance by modifying a buffer in...