Pádraig Brady <[email protected]> writes:

> On 26/06/2026 05:11, Collin Funk wrote:
>> This increases throughput on systems with unlocked stdio functions.
>> E.g., 2.5x in the following case:
>>      $ timeout 1m taskset 1 shuf -r -i 0-100 \
>>          | taskset 2 uniq -c \
>>          | taskset 3 pv -r > /dev/null
>>      [ 100MiB/s]
>>      $ timeout 1m taskset 1 shuf -r -i 0-100 \
>>          | taskset 2 uniq -c \
>>          | taskset 3 pv -r > /dev/null
>>      [ 246MiB/s]
>
> Nice speedup!
> I wonder could we refactor to a shared numeric output routine.

Good point. I pushed it yesterday, since I didn't realize you were away.

There is room to improve 'cksum', which prints each hex byte with a
separate printf call. Since the bulk of the time is spent hashing with
typical invocations, it doesn't really matter much. But we might as well
use a generic routine if a good one can be created.

There is some code in format_address_std function of 'od' that can
probably be used. The code written, written in 2000 as a separate
implementation for each base:

    /* Use a special case of the code for each base.  This is measurably
       faster than generic code.  */
    switch (address_base)
      {
      case 8:
        /* Base 8 conversion snipped.  */
        break;
  
      case 10:
        /* Base 10 conversion snipped.  */
        break;
  
      case 16:
        /* Base 16 conversion snipped.  */
        break;
      }

I wonder if that comment is still true today. I'll have to do some
testing.

Collin

Reply via email to