The most common use case for Oxc is reading a file from disk and parsing it.
Currently the parser takes a &str. We could add an API to read a file from disk into a SourceText buffer which is then passed to parser. Possibly SourceText would store the data in the arena.
There's a few advantages to this:
If you reuse the same SourceText buffer over and over when parsing many files, that'd likely be a perf gain, as source text would always be in a block of memory which is warm in the cache.
It'd remove the cost of string copying for #20.
It'd be useful for AST transfer for the source text to be in the arena - could make for more efficient code for extracting strings from the serialized buffer.
The most common use case for Oxc is reading a file from disk and parsing it.
Currently the parser takes a
&str
. We could add an API to read a file from disk into aSourceText
buffer which is then passed to parser. PossiblySourceText
would store the data in the arena.There's a few advantages to this:
SourceText
buffer over and over when parsing many files, that'd likely be a perf gain, as source text would always be in a block of memory which is warm in the cache.