Bug 452034 - Spelling is checked on the main thread
Summary: Spelling is checked on the main thread
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows NT
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2014-11-18 05:22 EST by Ed Willink CLA
Modified: 2015-11-11 04:16 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2014-11-18 05:22:44 EST
Checking spelling is a useful but secondary editor activity that IMHO should avoid degrading primary activities.

The stack trace below shows spelling being checked synchronously on the main thread delaying editor start up.

Surely spelling should be checked on a worker thread that determines the annotations to apply, then invokes a single modify operation to erase stale annotations and apply new ones, possibly suppressing the application of new annotations if the editor view has advanced sufficiently to render the new annotations stale?

Thread [main] (Suspended)	
	owns: LocaleSensitiveSpellDictionary  (id=1024)	
	StringCoding.deref(ThreadLocal<SoftReference<T>>) line: 63	
	StringCoding.encode(String, char[], int, int) line: 330	
	String.getBytes(String) line: 916	
	LocaleSensitiveSpellDictionary(AbstractSpellDictionary).hashWord(String) line: 484	
	LocaleSensitiveSpellDictionary(AbstractSpellDictionary).load(URL) line: 648	
	LocaleSensitiveSpellDictionary(AbstractSpellDictionary).isCorrect(String) line: 515	
	DefaultSpellChecker.isCorrect(String) line: 323	
	DefaultSpellChecker.execute(ISpellEventListener, ISpellCheckIterator) line: 250	
	TextSpellingEngine.check(IDocument, IRegion[], ISpellChecker, ISpellingProblemCollector, IProgressMonitor) line: 41	
	TextSpellingEngine(SpellingEngine).check(IDocument, IRegion[], SpellingContext, ISpellingProblemCollector, IProgressMonitor) line: 90	
	DefaultSpellingEngine.check(IDocument, IRegion[], SpellingContext, ISpellingProblemCollector, IProgressMonitor) line: 75	
	SpellingService$1.run() line: 104	
	SafeRunner.run(ISafeRunnable) line: 42	
	SpellingService.check(IDocument, IRegion[], SpellingContext, ISpellingProblemCollector, IProgressMonitor) line: 109	
	XtextSpellingReconcileStrategy.reconcile(IRegion) line: 78	
	XtextSpellingReconcileStrategy(SpellingReconcileStrategy).initialReconcile() line: 169	
	XtextDocumentReconcileStrategy.initialReconcile() line: 118	
	XtextReconciler.handleInputDocumentChanged(IDocument, IDocument) line: 264	
	XtextReconciler$TextInputListener.inputDocumentChanged(IDocument, IDocument) line: 179	
	XtextSourceViewer(TextViewer).fireInputDocumentChanged(IDocument, IDocument) line: 2889	
	XtextSourceViewer(TextViewer).setDocument(IDocument) line: 2938	
	XtextSourceViewer(SourceViewer).setDocument(IDocument, IAnnotationModel, int, int) line: 643	
	XtextSourceViewer(ProjectionViewer).setDocument(IDocument, IAnnotationModel, int, int) line: 375	
	XtextSourceViewer(SourceViewer).setDocument(IDocument, IAnnotationModel) line: 591	
	CompleteOCLEditor(AbstractTextEditor).initializeSourceViewer(IEditorInput) line: 4050	
	CompleteOCLEditor(AbstractTextEditor).createPartControl(Composite) line: 3578	
	CompleteOCLEditor(StatusTextEditor).createPartControl(Composite) line: 54	
	CompleteOCLEditor(AbstractDecoratedTextEditor).createPartControl(Composite) line: 447	
	CompleteOCLEditor(XtextEditor).createPartControl(Composite) line: 500	
	CompatibilityEditor(CompatibilityPart).createPartControl(IWorkbenchPart, Composite) line: 149	
	CompatibilityEditor.createPartControl(IWorkbenchPart, Composite) line: 99	
	CompatibilityEditor(CompatibilityPart).create() line: 335
Comment 1 Sebastian Zarnekow CLA 2014-11-18 05:30:10 EST
A patch is appreciated.
Comment 2 Ed Willink CLA 2014-11-18 06:09:31 EST
If an Eclipse user exited with a Xtext editor open, then the non-trivial cost of loading the spelling dictionary is incurred during Eclipse startup. MAJOR.
Comment 3 Ed Willink CLA 2014-11-18 06:50:43 EST
(In reply to Ed Willink from comment #2)
> non-trivial cost of loading the spelling dictionary

32 seconds.
Comment 4 Sebastian Zarnekow CLA 2014-11-18 06:51:39 EST
It'll certainly speed up the the operation that opens an editor.
Comment 5 Ed Willink CLA 2014-11-19 06:27:47 EST
(In reply to Ed Willink from comment #3)
> 32 seconds.

Something wierd with my Eclipse / Windows laptop yesterday. Only takes a second today; still worth off-loading.