Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15997

Performance bug of {1..1000000}?

From Peng Yu <pengyu.ut@gmail.com>
Newsgroups gnu.bash.bug
Subject Performance bug of {1..1000000}?
Date 2020-03-07 10:39 -0600
Message-ID <mailman.2243.1583599181.2412.bug-bash@gnu.org> (permalink)
References <CABrM6wmte=vqL1a8aHwLidDzcaUx3=G+n3ZsOz0TweHVFeQLjg@mail.gmail.com>

Show all headers | View raw


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

Back to gnu.bash.bug | Previous | Next | Find similar


Thread

Performance bug of {1..1000000}? Peng Yu <pengyu.ut@gmail.com> - 2020-03-07 10:39 -0600

csiph-web