Skip to content
New issue

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

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

Already on GitHub? # to your account

[overlays] Fix overlay slowness when huge result is displayed #3774

Merged
merged 1 commit into from
Feb 14, 2025

Conversation

alexander-yakushev
Copy link
Member

@alexander-yakushev alexander-yakushev commented Feb 14, 2025

Since calling string-width on a big string is very slow, displaying a big overlay (that we truncate later anyway) induces an unnecessary delay.

Here, I solve this by checking first for a too big of a result (10000 characters) that we certainly definitely going to truncate.


  • You've updated the changelog (if adding/changing user-visible functionality)

@alexander-yakushev alexander-yakushev force-pushed the overlay-slow branch 2 times, most recently from 6975ea3 to cb495cb Compare February 14, 2025 08:26
@alexander-yakushev alexander-yakushev changed the title [overlays] Fix overlay slowness when huge result is display [overlays] Fix overlay slowness when huge result is displayed Feb 14, 2025
@bbatsov
Copy link
Member

bbatsov commented Feb 14, 2025

Here, I solve this by checking first for a too big of a result (10000 characters) that we certainly definitely going to truncate.

How did you pick this size? Overall - your approach seems reasonable, although probably I'd some comments explaining it in the code.

@alexander-yakushev
Copy link
Member Author

I indeed just spitballed it. Now I think we can base the approximation on the screen width.

@alexander-yakushev
Copy link
Member Author

Updated, no more magic values.

@bbatsov
Copy link
Member

bbatsov commented Feb 14, 2025

Yeah, that's much nicer. Thanks!

@bbatsov bbatsov merged commit 7e9e70c into master Feb 14, 2025
45 checks passed
@alexander-yakushev alexander-yakushev deleted the overlay-slow branch February 14, 2025 17:21
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants