[Top][All Lists]

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

bug#23321: [PROPOSED PATCH] grep: /dev/null output speedup

From: Paul Eggert
Subject: bug#23321: [PROPOSED PATCH] grep: /dev/null output speedup
Date: Wed, 20 Apr 2016 23:52:56 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

address@hidden wrote:
Testing for same inode is likely to work but not guaranteed. I think
it'd be better to compare the major and minor device numbers on the two
stat buffers. If they're equal then you know for sure you have a null
device in hand.

I considered that, but major and minor device number checking is less portable, whereas inode-number checking should be quite portable (it is the approach used by GNU cmp, which also optimizes the case for stdout being /dev/null). In practice it's so rare to have two different inodes that both resolve to the null device, that it's probably not worth worrying about the porting hassle to optimize for that special case. (There's also NFS to worry about...)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]