bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

seq, why so slow?


From: Philip Rowlands
Subject: seq, why so slow?
Date: Mon, 7 Sep 2009 09:08:41 +0100 (BST)
User-agent: Alpine 1.10 (DEB 962 2008-03-14)

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

[Prev in Thread] Current Thread [Next in Thread]