- Notifications
You must be signed in to change notification settings - Fork1.8k
fix decorations on DOM renderer#4651
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -131,6 +131,11 @@ export class DomRendererRowFactory { | ||
| const isCursorCell = isCursorRow && x === cursorX; | ||
| const isLinkHover = hasHover && x >= linkStart && x <= linkEnd; | ||
| let isDecorated = false; | ||
| this._decorationService.forEachDecorationAtCell(x, row, undefined, d => { | ||
| isDecorated = true; | ||
| }); | ||
Comment on lines +134 to +137 MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. @Tyriar Is there a better way to determine, if a cell is decorated? This callback method runs several times for all matched decorations, while all I need is a Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. We can add a MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Hmm indeed, the generator has worse runtime, even if I break out of the iteration early 😢 MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. @Tyriar I was not able to find a faster access for a The toxic runtime part is the binary search across lines, plus the a linear search within the line, some numbers from my
with ~80% spent in Btw I was not able to test higher matches, seems the highlighting is capped in the search addon. Edit: On a sidenote - it might already help to reshape _search into a loop instead of recursive calls. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Any perf improvements are welcome of course, but I wouldn't worry too much about squeezing a lot out of looking up decorations as they are normally not used at all or used sparingly. VS Code only uses it with find (which performs good enough with many results), highlighting things temporarily and adding decorations next to commands for shell integration. Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Nice work if a MemberAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. The loop version shows these runtimes:
Btw a linear scan with Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. That would also allocate memory for the mapped arrays, but yeah we're after better scaling while should happen with the binary search | ||
| // get chars to render for this cell | ||
| let chars = cell.getChars() || WHITESPACE_CELL_CHAR; | ||
| if (chars === ' ' && (cell.isUnderline() || cell.isOverline())) { | ||
| @@ -160,6 +165,7 @@ export class DomRendererRowFactory { | ||
| && spacing === oldSpacing | ||
| && !isCursorCell | ||
| && !isJoined | ||
| && !isDecorated | ||
| ) { | ||
| // no span alterations, thus only account chars skipping all code below | ||
| text += chars; | ||
| @@ -386,7 +392,7 @@ export class DomRendererRowFactory { | ||
| } | ||
| // exclude conditions for cell merging - never merge these | ||
| if (!isCursorCell && !isInSelection && !isJoined && !isDecorated) { | ||
| cellAmount++; | ||
| } else { | ||
| charElement.textContent = text; | ||