@nothings @pervognsen "Write down the position of every \n in the file" SIMDs up nicely and the speed you can run it at is certainly in the same ballpark as your L2$ bandwidth (details would depend on the exact impl and output format).
One-byte-at-a-time branchy lexing certainly is not, especially when you take branches to count lines.