]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
grep: replace the internal queue with a ring buffer
authorKyle Evans <kevans@FreeBSD.org>
Wed, 9 Dec 2020 05:27:45 +0000 (05:27 +0000)
committerKyle Evans <kevans@FreeBSD.org>
Mon, 28 Dec 2020 03:19:26 +0000 (21:19 -0600)
commita3abf665833465461030c413f07d324e7d64ae30
tree3aa92878ceff24bc02764df40d991b79dee55614
parent7bb960ce6447bd535e0fbb648e4d9edbb1dc067f
grep: replace the internal queue with a ring buffer

We know up front how many items we can have in the queue (-B/Bflag), so
pay the cost of those particular allocations early on.

The reduced queue maintenance overhead seemed to yield about an ~8%
improvement for my earlier `grep -C8 -r closefrom .` test.

(cherry picked from commit df546c3b730d4abcace1da24226bd5f01280588e)
usr.bin/grep/grep.c
usr.bin/grep/grep.h
usr.bin/grep/queue.c