grep with --extended-regexp much slower on Ubuntu 16.04

Ralf Mardorf silver.bullet at zoho.com
Fri Feb 9 18:35:52 UTC 2018


On Fri, 9 Feb 2018 09:42:44 +0000, Brian Bird wrote:
>Since I can reproduce this consistently I would like to know if anyone
>else can/can't reproduce it on Ubuntu 16.04LTS?

Hi,

I can confirm that this at least happens when booting Ubuntu 16.04.3 LTS
from my Arch Linux install, in a systemd-nspawn container. It does even
happen, when running it in a systemd-nspawn container, if the boot option
isn't used, but if grep is run as user. Something is fishy, see [1].

Regards,
Ralf

[1]
[root at archlinux rocketmouse]# uname -a
Linux archlinux 4.14.15-rt13-1-rt-securityink #1 SMP PREEMPT RT Fri Feb 9 07:39:16 CET 2018 x86_64 GNU/Linux
[root at archlinux rocketmouse]# lsb_release -r
Release:	rolling
[root at archlinux rocketmouse]# systemd-nspawn -bqD /mnt/moonstudio
[snip]
[weremouse at moonstudio ~]$ lsb_release -r
Release:	16.04
[weremouse at moonstudio ~]$ openssl rand -out /tmp/random.txt -base64 100000000
[weremouse at moonstudio ~]$ time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m13.041s
user	0m12.999s
sys	0m0.037s
[weremouse at moonstudio ~]$ time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m13.005s
user	0m12.989s
sys	0m0.011s
[weremouse at moonstudio ~]$ shutdown -h now
[snip]
[root at archlinux rocketmouse]# systemd-nspawn -qD /mnt/moonstudio
[root at moonstudio ~]# openssl rand -out /tmp/random.txt -base64 100000000
[root at moonstudio ~]# time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m0.539s
user	0m0.478s
sys	0m0.061s
[root at moonstudio ~]# time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m0.533s
user	0m0.512s
sys	0m0.021s
[root at moonstudio ~]# logout
[root at archlinux rocketmouse]# systemd-nspawn --help | grep boot
  -b --boot                 Boot up full system (i.e. invoke init)
[root at archlinux rocketmouse]# systemd-nspawn -qD /mnt/moonstudio
[root at moonstudio ~]# sudo -iu weremouse
[weremouse at moonstudio ~]$ openssl rand -out /tmp/random.txt -base64 100000000
[weremouse at moonstudio ~]$ time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m13.084s
user	0m13.038s
sys	0m0.041s
[weremouse at moonstudio ~]$ time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt

real	0m13.059s
user	0m13.031s
sys	0m0.023s
[weremouse at moonstudio ~]$ logout
[root at moonstudio ~]# logout





More information about the ubuntu-users mailing list