I have a C++ code which has 3 array declarations.
float A[NUM];
float B[NUM];
float C[NUM];
When I compile with NUM=512, compilation is fast
time g++ -DNUM=512 trials trials.cpp -lm
0.16s user 0.04s system 94% cpu 0.219 total
However, when I compile with NUM=167772160, it takes more time.
time g++ -DNUM=167772160 trials trials.cpp -lm
7.90s user 0.69s system 99% cpu 8.604 total
I haven't used C++ in years. I am curious to know why there is a time difference in compilation though the object files after the compilation are of the same size.
-fno-zero-initialized-in-bssoption to the compiler and see if it makes any difference.