Re: the concern about the compiler optimizing away the loop: 1. (re)checked the assembly in Godbolt. Still unsure of SIMDing, but can point to the exact instruction that adds exactly three inside the loop. The sum is also not optimized away. 2. To make doubly sure (as this is compiler-specific), I added the following code right after array initialization and before the initial time check. It turns the value to add into a run-time variable. No effect on speed in Nim static arrays, for sufficiently long test times.
# Save a user-specified value to add to each element in the array stdout.write("Add how much to each element in the array, per cycle (must be an integer): ") # var to_add:type_t try: let tmp = readLine(stdin) to_add = type_t(parseInt(tmp)) except: echo "Could not read number!" (and, below, replace the addition of 3 with "to_add" in the loop) Run