Let's say I have:
type
Foo = object
bar: array[8, array[8, int]]
var f = Foo()
If I understand correctly, f.bar will be initialized to all zeros.
But is there any way to avoid this? I might set some values of f.bar later, but I don't need bar to be initialized to all zeros, and I don't care if I accidentally read a garbage value out of bar.
Normally I wouldn't care, but I want to do this millions of times a second. I have compared the difference in some analogous C++ code and the slowdown from initializing the array to zeros is significant for my particular use case.
From the manual:
https://nim-lang.org/docs/manual.html
The implicit initialization can be avoided for optimization reasons with the noinit pragma:
var
a {.noInit.}: array [0..1023, char]