grep with --extended-regexp much slower on Ubuntu 16.04
Ralf Mardorf
silver.bullet at zoho.com
Fri Feb 9 18:52:41 UTC 2018
On Fri, 9 Feb 2018 19:35:52 +0100, Ralf Mardorf wrote:
>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
FWIW it's seemingly not related to page-table isolation. I booted
Arch Linux from the below "LABEL Securityink" and not from the
"LABEL Securityink_nopti", however, 16.04 useres could test, if booting
with "nokaiser" makes a differences. Arch's grep doesn't suffer from the
performance issue. FWIW Arch's microcode is revision 0x23, while
Ubuntu's is revision 0x22, but this shouldn't matter, since I run Ubuntu
in a container.
[rocketmouse at archlinux ~]$ openssl rand -out /tmp/random.txt -base64 100000000
[rocketmouse at archlinux ~]$ time grep --extended-regexp "[0-9]{10}$" /tmp/random.txt
real 0m0.419s
user 0m0.375s
sys 0m0.043s
[rocketmouse at archlinux ~]$ cat /boot/syslinux/syslinux.cfg
# http://syslinux.zytor.com/wiki/index.php/Doc/menu
PROMPT 0
TIMEOUT 600
UI menu.c32
MENU HIDDEN
MENU CLEAR
MENU COLOR screen 0;30;40
MENU COLOR border 0;30;40
MENU COLOR title 1;37;44
MENU COLOR unsel 0;37;40
MENU COLOR hotkey 1;37;40
MENU COLOR hotsel 7;37;40
MENU COLOR sel 7;37;40
MENU COLOR disabled 1;37;40
MENU COLOR scrollbar 0;30;40
MENU COLOR tabmsg 0;30;40
MENU COLOR cmdmark 0;31;40
MENU COLOR cmdline 0;37;40
MENU COLOR timeout_msg 0;37;40
MENU COLOR timeout 1;37;40
# Used hotkeys: ^8 ^A ^C ^e ^H ^i ^k ^M ^n ^P ^Q ^R ^S ^t ^V
DEFAULT Securityink
MENU TITLE HAL 9000
LABEL Toolbox
MENU LABEL Toolbox
MENU DISABLE
MENU SEPARATOR
LABEL Hardware
MENU LABEL ^Hardware Detection
COM32 hdt.c32
LABEL Memtest
MENU LABEL Memtest^86+
LINUX /.boot/ubuntu_moonstudio/boot/memtest86+.bin
LABEL Reset
MENU LABEL R^eset
COM32 reboot.c32
MENU SEPARATOR
MENU SEPARATOR
LABEL Arch Menu
MENU LABEL Arch Linux
MENU DISABLE
MENU SEPARATOR
LABEL Threadirqs
MENU LABEL Arch Linux ^threadirqs
LINUX ../vmlinuz-linux
APPEND root=LABEL=archlinux ro threadirqs
INITRD ../intel-ucode.img,../initramfs-linux.img
LABEL Threadirqs_nopti
MENU LABEL Arch Linux threadirqs ^nopti
LINUX ../vmlinuz-linux
APPEND root=LABEL=archlinux ro threadirqs nopti
INITRD ../intel-ucode.img,../initramfs-linux.img
LABEL Securityink
MENU LABEL Arch Linux Rt ^Securityink
LINUX ../vmlinuz-linux-rt-securityink
APPEND root=LABEL=archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux-rt-securityink.img
LABEL Securityink_nopti
MENU LABEL Arch Linux Rt Securityink nopt^i
LINUX ../vmlinuz-linux-rt-securityink
APPEND root=LABEL=archlinux ro nopti
INITRD ../intel-ucode.img,../initramfs-linux-rt-securityink.img
LABEL Pussytoes
MENU LABEL Arch Linux Rt ^Pussytoes
LINUX ../vmlinuz-linux-rt-pussytoes
APPEND root=LABEL=archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux-rt-pussytoes.img
LABEL Cornflower
MENU LABEL Arch Linux Rt ^Cornflower
LINUX ../vmlinuz-linux-rt-cornflower
APPEND root=LABEL=archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux-rt-cornflower.img
LABEL Rt
MENU LABEL Arch Linux ^Rt
LINUX ../vmlinuz-linux-rt
APPEND root=LABEL=archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux-rt.img
LABEL Arch
MENU LABEL ^Arch Linux
LINUX ../vmlinuz-linux
APPEND root=LABEL=archlinux ro
INITRD ../intel-ucode.img,../initramfs-linux.img
MENU SEPARATOR
MENU SEPARATOR
LABEL Other Menu
MENU LABEL Other Linux
MENU DISABLE
MENU SEPARATOR
LABEL Moonstudio
MENU LABEL Ubuntu X ^Moon Studio lowlatency
LINUX /.boot/ubuntu_moonstudio/boot/vmlinuz-lowlatency
APPEND root=LABEL=moonstudio ro
INITRD /.boot/ubuntu_moonstudio/boot/initrd.img-lowlatency
LABEL Nokaiser
MENU LABEL Ubuntu X Moon Studio lowlatency no^kaiser
LINUX /.boot/ubuntu_moonstudio/boot/vmlinuz-lowlatency
APPEND root=LABEL=moonstudio ro nokaiser
INITRD /.boot/ubuntu_moonstudio/boot/initrd.img-lowlatency
LABEL Light
MENU LABEL Ubuntu ^Q LightScribe Rt
LINUX /.boot/ubuntu_q/boot/vmlinuz-3.6.5-rt14
APPEND root=LABEL=q ro nomodeset
INITRD /.boot/ubuntu_q/boot/initrd.img-3.6.5-rt14
LABEL Suse
MENU LABEL ^Vintage SUSE 11.2 Rt
LINUX /.boot/suse11.2/boot/vmlinuz-2.6.31.6-rt19
APPEND root=LABEL=suse11.2
INITRD /.boot/suse11.2/boot/initrd-2.6.31.6-rt19
More information about the ubuntu-users
mailing list