Limit search response size to avoid crash/perf issues#1753
Merged
dzhou121 merged 1 commit intolapce:masterfrom Nov 26, 2022
Merged
Limit search response size to avoid crash/perf issues#1753dzhou121 merged 1 commit intolapce:masterfrom
dzhou121 merged 1 commit intolapce:masterfrom
Conversation
ae4ba7f to
eb7af1a
Compare
Codecov Report
@@ Coverage Diff @@
## master #1753 +/- ##
=========================================
- Coverage 6.54% 6.54% -0.01%
=========================================
Files 127 127
Lines 54089 54100 +11
=========================================
Hits 3541 3541
- Misses 50548 50559 +11
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CHANGELOG.mdif this change could be valuable to usersThere was a bug where searching in a workspace with files with large one-liner text would cause the editor to die (sometimes crash, sometimes visual artifacts due to creating a too large text layout and maybe messing with GPU memory or something). A common example would be minified javascript files, which are on a singular line and are quite massive.
The issue was that the search would respond with the entire line's text, which could be a lot (ex: one of my files was 500kb of text in a single line)! This wouldn't be too bad by itself, though it would probably stress search performance if you had a lot of them, but the main issue comes from trying to render it. It would try creating a text layout, which would then cause issues due to it being so large.
The fix is just to take a part of the line, 100 characters before and 100 characters after the end of the match, and restrict the text sent (and thus displayed) to that.