Interestingly enough, noone actually ever mentioned the fastest way to do bash loops:
x=4000000
declare -i i=0
while ((i++ < x)); do
:
done
or for other than +1 iterations (slightly slower) use:
x=4000000
i=-1
while (((i += 1) < x)); do
:
done
Which is about 17% faster than the C-like for loop.