@nothings @pervognsen FWIW, in that article, about re-scanning to find line numbers:
"If every file has at least one warning, this will clearly be slower."
Not even that, necessarily! If the files are large enough to thrash the cache maybe, but if they fit in L2 (which these days is south of 1MB) there's decent odds a two-pass approach where one pass lexes and one pass marks the start offsets for every line is faster than many common impls of a lexer that tracks line numbers in the inner loop.