Tuples and Vectors, Allocations and Performance for Beginners

By: jkrumbiegel.com

Re-posted from: https://jkrumbiegel.com/pages/2020-10-31-tuples-and-vectors/index.html

If you’re new to Julia, here is a scenario that might have tripped you up already: Let’s define two points. Both are just a collection of two floating point numbers. But one is a Vector, written with the [] syntax, and one a Tuple, written with the () syntax. Then we make vectors of both types of points and run a short computation. Let’s see what the performance difference looks like.