Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceFile.getText is doing too many allocations #37

Open
klavs opened this issue Jul 20, 2019 · 1 comment · Fixed by #44
Open

SourceFile.getText is doing too many allocations #37

klavs opened this issue Jul 20, 2019 · 1 comment · Fixed by #44
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) type-enhancement A request for a change that isn't a bug

Comments

@klavs
Copy link

klavs commented Jul 20, 2019

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.

String getText(int start, [int end]) =>
new String.fromCharCodes(_decodedChars.sublist(start, end));

@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) labels Nov 7, 2019
kevmoo added a commit that referenced this issue Nov 7, 2019
@kevmoo kevmoo closed this as completed in #44 Nov 7, 2019
kevmoo added a commit that referenced this issue Nov 7, 2019
@natebosch
Copy link
Member

Reopening since I have to revert this in #46

@natebosch natebosch reopened this Nov 14, 2019
nex3 pushed a commit to nex3/source_span that referenced this issue Jul 2, 2024
Changes to comply with internal review
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributions-welcome Contributions welcome to help resolve this (the resolution is expected to be clear from the issue) type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants