Bug 575990 - copy&paste java code Ui Freeze HyperlinkManager / PatternSearchJob
Summary: copy&paste java code Ui Freeze HyperlinkManager / PatternSearchJob
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.20   Edit
Hardware: PC Windows 10
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2021-09-15 02:46 EDT by Jörg Kubitz CLA
Modified: 2021-09-16 02:12 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Kubitz CLA 2021-09-15 02:46:21 EDT
I just had a big (20s) lag (after copy&pasting source) with multiple stacktrace samples in MAIN thread like
	at org.eclipse.jdt.core.compiler.CharOperation.match(CharOperation.java:3070)
	at org.eclipse.jdt.core.compiler.CharOperation.pathMatch(CharOperation.java:3192)	at org.eclipse.jdt.internal.compiler.env.AccessRuleSet.getViolatedRestriction(AccessRuleSet.java:79)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine$5.acceptIndexMatch(BasicSearchEngine.java:1845)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.lambda$1(PatternSearchJob.java:139)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob$$Lambda$750/0x0000000800e5f440.accept(Unknown Source)
	at java.base@11.0.9.1/java.util.ArrayList.forEach(ArrayList.java:1541)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.performParallelSearch(PatternSearchJob.java:138)
	at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute(PatternSearchJob.java:97)
	at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:265)
	at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllTypeNames(BasicSearchEngine.java:1857)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.findTypes(SearchableEnvironment.java:662)
	at org.eclipse.jdt.internal.core.SearchableEnvironment.findTypes(SearchableEnvironment.java:503)
	at org.eclipse.jdt.internal.codeassist.SelectionEngine.select(SelectionEngine.java:1103)
	at org.eclipse.jdt.internal.core.Openable.codeSelect(Openable.java:167)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:389)
	at org.eclipse.jdt.internal.core.CompilationUnit.codeSelect(CompilationUnit.java:382)
	at org.eclipse.xtext.common.types.ui.navigation.LinkToOriginDetector.detectHyperlinks(LinkToOriginDetector.java:72)
	at org.eclipse.ui.texteditor.HyperlinkDetectorRegistry$HyperlinkDetectorDelegate.detectHyperlinks(HyperlinkDetectorRegistry.java:81)
	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
	at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:262)
	at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:457)


maybe we could optimize that a bit somewhere or make it run async.
Comment 1 Andrey Loskutov CLA 2021-09-15 02:49:48 EDT
Shouldn't this be moved to xtext? 

org.eclipse.xtext.common.types.ui.navigation.LinkToOriginDetector.detectHyperlinks(LinkToOriginDetector.java:72)
Comment 2 Jörg Kubitz CLA 2021-09-15 03:07:40 EDT
(In reply to Andrey Loskutov from comment #1)
> Shouldn't this be moved to xtext? 

depends. 

a) jdt.core.compiler.CharOperation : jdt - maybe optimize
b) jface.text.hyperlink.HyperlinkManager : platform - maybe async
c) xtext.common.types.ui.navigation.LinkToOriginDetector : xtext - i got no idea
Comment 3 Christian Dietrich CLA 2021-09-15 03:11:02 EDT
for Xtext this would be a help wanted
can we detect that codeSelect
will have a problem and simply skip then?
Comment 4 Christian Dietrich CLA 2021-09-15 03:14:43 EDT
org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(ITextViewer, IRegion, boolean)
seems to call the same codeSelect
why wont it freeze too?
Comment 5 Jörg Kubitz CLA 2021-09-15 03:22:40 EDT
(In reply to Christian Dietrich from comment #4)
> org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.
> detectHyperlinks(ITextViewer, IRegion, boolean)
> seems to call the same codeSelect
> why wont it freeze too?

i took a deeper look at the other samples. yes there are also some org.eclipse.jdt.internal.ui.javaeditor.JavaElementHyperlinkDetector.detectHyperlinks(JavaElementHyperlinkDetector.java:124)


=> not an xtext problem.
Comment 6 Andrey Loskutov CLA 2021-09-15 03:33:19 EDT
(In reply to Jörg Kubitz from comment #2)
> b) jface.text.hyperlink.HyperlinkManager : platform - maybe async

This is what then need to be addressed. JDT can't guarantee instant search for any particular type, that must be done in background.
Comment 7 Jörg Kubitz CLA 2021-09-15 09:46:30 EDT
moved to platform