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


Groups > comp.os.linux.misc > #16962

seq command terribly slow

From Robert Riches <spamtrap42@jacob21819.net>
Newsgroups comp.os.linux.misc
Subject seq command terribly slow
Date 2016-03-13 04:18 +0000
Organization none-at-all
Message-ID <slrnne9qgo.5pk.spamtrap42@one.localnet> (permalink)

Show all headers | View raw


Any ideas why the seq command is so terribly slow?

In order to test whether a new (well, used, but that's another
story) disk, I tried using seq to generate a non-repeating
pattern.  After seeing seq consuming 100% CPU time and a very low
data rate being written to disk, I did some checking on a
few-years-old system with a Xeon W3680 running Debian 7/Wheezy.

This command shows about 15MB/s:

    seq 1e12 | pv > /dev/null

This command shows about 600MB/s, ~40X faster with much lower
total CPU use:

    yes '' | cat -n | tr -d ' \t' | head -c 1000000000000 | pv > /dev/null

Even this simple Python program shows about 12MB/s:
(indented for this posting)

    first     = 1.0
    last      = 1.0e12
    increment = 1.0
    
    i = first
    while (last >= i):
        print('%.0f' % i)
        i += increment

Yes, the seq command has a lot of formatting options.  They
should basically all be handled at initialization time and not
incur a significant CPU penalty in the main loop.

Any ideas why seq is to slow?

Thanks.

-- 
Robert Riches
spamtrap42@jacob21819.net
(Yes, that is one of my email addresses.)

Back to comp.os.linux.misc | Previous | NextNext in thread | Find similar | Unroll thread


Thread

seq command terribly slow Robert Riches <spamtrap42@jacob21819.net> - 2016-03-13 04:18 +0000
  Re: seq command terribly slow Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-13 12:24 +0000
    Re: seq command terribly slow Robert Riches <spamtrap42@jacob21819.net> - 2016-03-13 16:42 +0000
      Re: seq command terribly slow "Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at> - 2016-03-14 14:22 +0100
        Re: seq command terribly slow Robert Riches <spamtrap42@jacob21819.net> - 2016-03-15 02:38 +0000
  Re: seq command terribly slow Gernot Fink <g.fink@gmx.net> - 2016-03-13 18:21 +0100
    Re: seq command terribly slow Richard Kettlewell <rjk@greenend.org.uk> - 2016-03-13 17:45 +0000
  Re: seq command terribly slow Eli the Bearded <*@eli.users.panix.com> - 2016-03-14 21:58 +0000
    Re: seq command terribly slow Robert Riches <spamtrap42@jacob21819.net> - 2016-03-15 02:44 +0000
      Re: seq command terribly slow Eli the Bearded <*@eli.users.panix.com> - 2016-03-16 00:41 +0000

csiph-web