diku-dk / futhark

:boom::computer::boom: A data-parallel functional programming language
http://futhark-lang.org
ISC License
2.41k stars 166 forks source link

Tracking source locations in the lexer is pretty costly #2161

Open athas opened 5 months ago

athas commented 5 months ago

Our lexer spends about 50% of its runtime constructing and maintaining source position information. Most of this information is not actually going to be used (even a very verbose error message may only need to reference about a handful).

Perhaps we should instead identify source positions simply by a character offset, and then compute column/line number as necessary by reference to the file, when needed.