Package: sed
Version: 4.2.1-9
Severity: wishlist

sed is inefficient on a regexp starting with "(.*":

$ time sed -n "s/\(.*49026\)/\1/p" ChangeLog
2012-01-12 23:39:18 (rev 49026, vinc17/xvii)
4.62s user 0.00s system 99% cpu 4.637 total

Compare to the equivalent:

$ time sed -n "s/^\(.*49026\)/\1/p" ChangeLog
2012-01-12 23:39:18 (rev 49026, vinc17/xvii)
0.27s user 0.00s system 99% cpu 0.278 total

perl doesn't have this problem:

$ time perl -ne "s/(.*49026)/\1/ and print" ChangeLog
2012-01-12 23:39:18 (rev 49026, vinc17/xvii)
0.08s user 0.00s system 98% cpu 0.081 total

$ time perl -ne "s/^(.*49026)/\1/ and print" ChangeLog
2012-01-12 23:39:18 (rev 49026, vinc17/xvii)
0.06s user 0.01s system 94% cpu 0.076 total

-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 
'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=POSIX, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages sed depends on:
ii  dpkg          1.16.1.2
ii  install-info  4.13a.dfsg.1-8
ii  libc6         2.13-24
ii  libselinux1   2.1.0-4

sed recommends no packages.

sed suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to