You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When the existing number of highlighters that apply to a function is large (global highlighters + secondary for that function), the computation of token highlights is extremely slow. This is made worse by #3749 which prevents a user from creating a secondary highlight, meaning all highlights are global and will apply to all functions.
The responsible code path for global highlights is as follows (there is a similar path for secondary highlights)
Note the multiple iterations over highlighters (as well as double call to clearHighlights) which causes unnecessary quadratic complexity in computation.
There may also be other similar issues in the code for clearing highlights
DecompilerPanel.reapplyGlobalHighlights
Set<DecompilerHighlighter> globalHighlighters = highlightController.getGlobalHighlighters();
for (DecompilerHighlighter highlighter : globalHighlighters) {
highlighter.clearHighlights();
highlighter.applyHighlights();
}
ClangDecompilerHighlighter.applyHighlights
clearHighlights();
Map<ClangToken, Color> highlights = new HashMap<>();
try {
matcher.start(root);
gatherHighlights(root, highlights);
}
finally {
matcher.end();
}
Supplier<? extends Collection<ClangToken>> tokens = () -> highlights.keySet();
ColorProvider colorProvider = new MappedTokenColorProvider(highlights);
decompilerPanel.addHighlighterHighlights(this, tokens, colorProvider);
DecompilerPanel.addHighlighterHighlights
ClangHighlightController.addHighlighterHighlights
ClangHighlightController.addTokensToHighlights
for (ClangToken clangToken : tokens) {
Color color = colorProvider.getColor(clangToken);
doAddHighlight(clangToken, color, currentHighlights);
}
ClangHighlightController.doAddHighlight
ClangHighlightController.updateHighlightColor
ClangHighlightController.getCombinedColor
ClangHighlightController.blendHighlighterColors
Set<DecompilerHighlighter> global = getGlobalHighlighters();
Set<DecompilerHighlighter> secondary = getSecondaryHighlighters(function);
Iterable<DecompilerHighlighter> it = CollectionUtils.asIterable(global, secondary);
Color lastColor = null;
for (DecompilerHighlighter highlighter : it) {
...
}
The text was updated successfully, but these errors were encountered:
Describe the bug
When the existing number of highlighters that apply to a function is large (global highlighters + secondary for that function), the computation of token highlights is extremely slow. This is made worse by #3749 which prevents a user from creating a secondary highlight, meaning all highlights are global and will apply to all functions.
The responsible code path for global highlights is as follows (there is a similar path for secondary highlights)
Note the multiple iterations over highlighters (as well as double call to
clearHighlights
) which causes unnecessary quadratic complexity in computation.There may also be other similar issues in the code for clearing highlights
The text was updated successfully, but these errors were encountered: