source_span
source_span copied to clipboard
SourceFile.getText is doing too many allocations
trafficstars
I am stress-testing my parser and SourceFile.getText seems to be making unnecessary allocations.
Isn't String.fromCharCodes(_decodedChars, start, end); a valid substitute? It appears to cause much less allocations this way.
https://github.com/dart-lang/source_span/blob/f9343087ba37f0cb089648b75fc30d99d2eb2c26/lib/src/file.dart#L216-L217
Reopening since I have to revert this in https://github.com/dart-lang/source_span/pull/46