NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [SOLVED-ish] Performance weirdness with netbsd-9 /usr/bin/grep



On Sat, 23 May 2020 14:04:56 +0200
Martin Husemann <martin%duskware.de@localhost> wrote:

> On Sat, May 23, 2020 at 10:19:28AM +0100, Sad Clouds wrote:
> > rp3$ locale
> > LANG=""
> > LC_CTYPE="C"
> > LC_COLLATE="C"
> > LC_TIME="C"
> > LC_NUMERIC="C"
> > LC_MONETARY="C"
> > LC_MESSAGES="C"
> > LC_ALL=""
> 
> I get the same for netbsd-8 and netbsd-7.
> 
> Martin

Probably nothing to do with locales. First time grep is run, data is
read from disk into page cache, which takes time. Second time grep is
run with LC_ALL=C but there is no disk I/O, as data is read straight
from page cache, so much faster.

I tried to simulate with a memory file under /var/shm and don't
see any significant difference. 

Create large ASCII file:
rp3$ strings /netbsd >> /var/shm/out.txt
rp3$ for i in `seq 1 100`; do cat /var/shm/out.txt >> /var/shm/out2.txt; done

Run grep with LC_ALL="":
rp3$ time grep -c 'NoSuchString' /var/shm/out2.txt
0
        0.84 real         0.23 user         0.56 sys

Run grep with LC_ALL="C":
rp3$ export LC_ALL=C
rp3$ time grep -c 'NoSuchString' /var/shm/out2.txt
0
        0.94 real         0.23 user         0.67 sys

rp3$ rm /var/shm/out*


Home | Main Index | Thread Index | Old Index