| Task | #4 |
|---|---|
| Position | 10 |
| Score | 640,489 |
| Best Score | 118,887 |
| Points | 0.186 |
Problem Statement
You have a data stream of uint32 numbers in binary representation sending to STDIN. The byte order is little endian.
Try to find the uint64 CRC of these numbers for the shortest time by the formula:
CRC += number_crc(n),
where number_crc is the sum of the ascii ids of digits in the decimal system multiplied by the position of the digit.
Numbers quantity is 250 000 000.
Input Generator
Random Bytes (confirmed with distcheck)
Solution Sketch
Same constexpr LUT technique used in Fizz Buzz, with more aggressive prefetching/unrolling because there’s no branches, and tighter LUTs because we don’t store the string anymore, but just the checksums.
Thoughts
This challenge has the largest amount of input, almost a gigabyte. Asked on the group how this works, the cgroups memory restriction applies to the owner of the pages, which is the process that generated the input. That process has a cgroups limit of 2GB, so we don’t OOM. The server itself has 32G memory, so if you’re benchmarking multiple format_ints solutions, it will still not OOM.