4 ms·
It takes a lot to to correctly explain exactly why the set of design choices is fastest, but writing just takes quite a simple model of the CPU internals, knowl
by fulafel 5y ago
It takes a lot to to correctly explain exactly why the set of design choices is fastest, but writing just takes quite a simple model of the CPU internals, knowledge of the insturction set, focus on constantly measuring performance, and an agility to iterate quickly with different approaches.
- fulafel 5y agoAnd reading more closely, beating the competition low level OS knowledge and understanding peculiarities of the benchmark in question. The benchmark was about getting the output to a pipe as fast as possible, and there's this great pipe speed hack: // To produce output without losing speed, the program therefore needs // to avoid copies, or at least do them in parallel with calculating // the next block of output. This can be accomplished with the // `vmsplice` system call, which tells the kernel to place a reference // to a buffer into a pipe (as opposed to copying the data into the // pipe); the program at the other end of this pipe will then be able // to read the output directly out of this program's memory, with no // need to copy the data into kernelspace and then back into // userspace.