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

Refactor jsonrepair.ts and core.ts to not use .charCodeAt #140

Merged
merged 7 commits into from
Feb 6, 2025

Conversation

josdejong
Copy link
Owner

@josdejong josdejong commented Jan 31, 2025

Originally, the use of .charCodeAt was introduced to improve performance. Some testing did show that in most cases, it doesn't actually improve the performance. It makes the code more verbose and harder to read though. Therefore, this PR refactors jsonrepair.ts and core.ts to not use .charCodeAt.

There is one case where it actually helps to use .charCodeAt: in the function isWhiteSpace and similar functions. In that case, we can move calling .charCodeAt inside the function isWhiteSpace.

@josdejong josdejong merged commit aca3377 into main Feb 6, 2025
7 checks passed
@josdejong josdejong deleted the chore/charCodeAt branch February 6, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant