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

remove quadratic limitation on counting quotes #5599

Merged
merged 2 commits into from
Mar 3, 2025

Conversation

aryairani
Copy link
Contributor

@aryairani aryairani commented Mar 3, 2025

The old implementation called Text.breakOnAll repeatedly, which could be slow, so it was capped at 10 quotes. The new implementation instead just calls Text.group once instead.

The PR could use a before and after check with a string with more than 10 consecutive " in it, and we should see that the rendering is improved with the PR. Existing tests show """ correctly being escaped as """" though, and since the PR removes the reference to 10, there isn't actually anything special about 10 going forward.

@aryairani aryairani requested a review from runarorama March 3, 2025 16:55
@aryairani
Copy link
Contributor Author

Things I debated:

I considered writing a single function to fuse all of the operations from longestRun into a single loop, but in the end I went with the Copilot-written one-liner.

@aryairani aryairani merged commit aec1b22 into trunk Mar 3, 2025
32 checks passed
@aryairani aryairani deleted the topic/quadratic-quotes branch March 3, 2025 21:40
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.

3 participants