Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jun 2026 16:49:43 +0200
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org,  dev-commits-src-main@FreeBSD.org
Subject:   Re: git: ffe47c424e0a - main - grep: periodic timer-based fflush instead of unconditional per-line flush
Message-ID:  <ai6_RlX3Cq280xMT@b.nours.eu>
In-Reply-To: <6a2eba3d.37a89.6e8ac4b2@gitrepo.freebsd.org>

index | next in thread | previous in thread | raw e-mail

On Sun 14 Jun 14:27, Baptiste Daroussin wrote:
> The branch main has been updated by bapt:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=ffe47c424e0a45f5d8d20a5944477821bd946eef
> 
> commit ffe47c424e0a45f5d8d20a5944477821bd946eef
> Author:     Baptiste Daroussin <bapt@FreeBSD.org>
> AuthorDate: 2026-06-12 12:13:35 +0000
> Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
> CommitDate: 2026-06-14 14:26:30 +0000
> 
>     grep: periodic timer-based fflush instead of unconditional per-line flush
>     
>     Replace the unconditional fflush(stdout) in grep_printline and
>     procmatches with a periodic timer that flushes at most once every
>     100ms.  This preserves interactive responsiveness (grep | tee,
>     grep | tail -f) while avoiding 1M+ write(2) syscalls when
>     processing large inputs.
>     
>     The flush interval is tracked via clock_gettime(CLOCK_MONOTONIC)
>     and a static timespec.  --line-buffered continues to flush
>     immediately via setlinebuf(3), as before.
>     
>     Benchmark on 1M lines (37MB output to file):
>       unconditional fflush:  1.90s  (sys 1.22s)
>       periodic 100ms timer:   0.49s  (sys 0.007s)
>     
>     Reviewed by:            kevans
>     Differential Revision:  https://reviews.freebsd.org/D57528

The actuall review is: https://reviews.freebsd.org/D57563

Best regards
Bapt


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ai6_RlX3Cq280xMT>