coreutils
[Top][All Lists]
Advanced

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

Re: [DRAFT] join: improve performance in ASCII locales


From: Collin Funk
Subject: Re: [DRAFT] join: improve performance in ASCII locales
Date: Mon, 31 Aug 2026 21:04:26 -0700
User-agent: Gnus/5.13 (Gnus v5.13)

Collin Funk <collin.funk1@gmail.com> writes:

>       if (MB_CUR_MAX <= 1)
> +        {
> +          do
> +            {
> +              char *start = ptr + strspn (ptr, "\n\t ");
> +              char *end = start + strcspn (start, "\n\t ");
> +              idx_t const len = end - start;
> +              if (0 < len)
> +                extract_field (line, start, len);
> +              ptr = end + (ptr < lim);
> +            }
> +          while (ptr < lim);
> +        }

Oops, I rewrote the patch to simplify it a bit. In the process I forgot
to add the null terminator, since the line buffer doesn't do that for
us. It would be something like this:

      if (MB_CUR_MAX <= 1)
        {
          line->buf.buffer[line->buf.length - 1] = '\0';
          do
            {
              char *start = ptr + strspn (ptr, "\n\t ");
              char *end = start + strcspn (start, "\n\t ");
              idx_t const len = end - start;
              if (0 < len)
                extract_field (line, start, len);
              ptr = end + (ptr < lim);
            }
          while (ptr < lim);
          line->buf.buffer[line->buf.length - 1] = eolchar;
        }



reply via email to

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