Speed up -L, multibyte decoding, and long file lists
-L was a serial byte-at-a-time walk, the multibyte path decoded every byte of a file serially after wasting a probe pass on it, and a long file list was counted one file at a time. - Width now has its own kernel family: scalar, AVX-2, AVX-512, and an AVX-512+VBMI2 prefix-sum walk that computes a whole block's line widths at once. Slices start after a line end, so they fold by maximum and -L runs across cores. - UTF-8 chunks decode independently (no shift state), ASCII stretches go to the byte kernels, and only the characters around a high byte are decoded. A first-KiB sample skips the wasted probe pass, and malformed input falls back to the streaming decoder's GNU-exact error handling. - Thread count follows a cost model (a thread per half megabyte, a quarter for -L) over sched_getaffinity narrowed by the cgroup CPU quota instead of a machine-wide sysconf count. - File lists of eight or more are counted on a worker pool, one file per worker, with rows printed in argument order and errors serialized. - -m in a single-byte locale uses the file size like -c already did. 1060 MB of 1050 files: 45 ms against GNU's 1.5 s and the Rust clone's 145 ms. -L on 1.1 GB: 62 ms against 1.5 s and 142 ms.
This commit is contained in:
+1341
-95
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user