Questions : grep package : Ubuntu

File is http://changelogs.ubuntu.com/changelogs/pool/main/g/grep/grep_3.7-1build1/changelog

$ docker run –rm -it -v `pwd`:/host ubuntu:latest bash
root@c45afb5dffac:/# cat /etc/os-release
PRETTY_NAME=”Ubuntu 22.04.3 LTS”
NAME=”Ubuntu”
VERSION_ID=”22.04″
VERSION=”22.04.3 LTS (Jammy Jellyfish)”
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL=”https://www.ubuntu.com/“
SUPPORT_URL=”https://help.ubuntu.com/“
BUG_REPORT_URL=”https://bugs.launchpad.net/ubuntu/“
PRIVACY_POLICY_URL=”https://www.ubuntu.com/legal/terms-and-policies/privacy-policy“
UBUNTU_CODENAME=jammy
root@c45afb5dffac:/# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m14.835s
user 0m12.692s
sys 0m3.912s
root@c45afb5dffac:/# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m12.363s
user 0m11.466s
sys 0m2.815s
root@c45afb5dffac:/# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m12.453s
user 0m11.326s
sys 0m3.061s
root@c45afb5dffac:/# exit
exit

$ docker run –rm -it -v `pwd`:/host centos:latest bash
[root@00e709d9037f /]# cat /etc/os-release
NAME=”CentOS Linux”
VERSION=”8″
ID=”centos”
ID_LIKE=”rhel fedora”
VERSION_ID=”8″
PLATFORM_ID=”platform:el8″
PRETTY_NAME=”CentOS Linux 8″
ANSI_COLOR=”0;31″
CPE_NAME=“cpe:/o:centos:centos:8″
HOME_URL=”https://centos.org/“
BUG_REPORT_URL=”https://bugs.centos.org/“
CENTOS_MANTISBT_PROJECT=“CentOS-8″
CENTOS_MANTISBT_PROJECT_VERSION=“8”
[root@00e709d9037f /]# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m11.617s
user 0m9.789s
sys 0m2.781s
[root@00e709d9037f /]# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m11.567s
user 0m9.838s
sys 0m2.704s
[root@00e709d9037f /]# time (for i in {1..10000}; do grep -q -m 1 -F “Revamped debian” /host/grep_changelog; done)

real 0m12.013s
user 0m9.798s
sys 0m2.983s
[root@00e709d9037f /]#

Any ideas how to speed up Ubuntu’s version ?

Read more here: Source link