bug-bash
[Top][All Lists]
Advanced

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

Performance bug of {1..1000000}?


From: Peng Yu
Subject: Performance bug of {1..1000000}?
Date: Sat, 7 Mar 2020 10:39:36 -0600

See the following run time comparison. {1..1000000} is slower than
$(seq 1000000).

Since seq involves an external program, I'd expect the latter to be
slower. But the comparison shows the opposite.

I guess seq did some optimization?

Can the performance of {1..1000000} be improved so that it is faster
than $(seq 1000000)?

$ time builtin printf %.sx {1..1000000}  > /dev/null

real    0m2.614s
user    0m2.361s
sys     0m0.166s
$ time builtin printf %.sx $(seq 1000000)  > /dev/null

real    0m1.516s
user    0m1.317s
sys     0m0.158s

-- 
Regards,
Peng



reply via email to

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