The conversion of everything to long doubles internally makes seq a lot slower than it needs to be in integer cases, I assume from the use of floating-point multiplication for every line of output:

seq.c:257          x = first + i * step;

$ time seq 1000000 > /dev/null

real    0m1.616s
user    0m1.610s
sys     0m0.004s


$ time ./myseq 1000000 > /dev/null

real    0m0.280s
user    0m0.275s
sys     0m0.005s


Would it be possible to detect arguments which require no floating-point, and handle them with integer addition?


Cheers,
Phil


Reply via email to