Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 336943 - LazyLinkingResource.removeDiagnostic performance concerns
Summary: LazyLinkingResource.removeDiagnostic performance concerns
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Windows Vista
: P3 normal (vote)
Target Milestone: M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-11 09:47 EST by Ed Willink CLA
Modified: 2017-10-31 10:59 EDT (History)
0 users

See Also:
sven.efftinge: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Willink CLA 2011-02-11 09:47:50 EST
It appears that the normal control flow on resolving any reference is to create an unresolved message diagnostic in order to remove that diagnostic from the prevailing resource error/warning lists.

This is undesirable since construction of the message may involve many internationalised string concatenation and property lookups; not enormously expensive but hardly lightweight as is necessary for an _every_ reference overhead.

Particularly inefficient seems to be

	protected void removeDiagnostic(Triple<EObject, EReference, INode> triple) {
		DiagnosticMessage message = createDiagnosticMessage(triple);
		List<Diagnostic> list = getDiagnosticList(message);
		if (!list.isEmpty()) {
			Diagnostic diagnostic = createDiagnostic(triple, message);
			list.remove(diagnostic);
		}
	}

where createDiagnosticMessage preceeds the list.isEmpty() test.

In practice an outer guard on errors or warnings will often find that there are no errors or warnings anyway so no need to construct a message template for a removal.

Shouldn't the messages be indexed by some kind of hash wrt the triple so that the messages can be located directly from the triple? indeed this might allow faster incremental update by supporting an old-triple / new-triple correlation.
Comment 1 Sven Efftinge CLA 2012-11-20 12:30:57 EST
pushed check for no diagnostics to master
Comment 2 Eclipse Webmaster CLA 2017-10-31 10:48:21 EDT
Requested via bug 522520.

-M.
Comment 3 Eclipse Webmaster CLA 2017-10-31 10:59:24 EDT
Requested via bug 522520.

-M.