Skip to content

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants