Bug 459964 - [performance] WorkbenchPage.findEditor is slow on not initialized editors
Summary: [performance] WorkbenchPage.findEditor is slow on not initialized editors
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 4.5 M6   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: greatfix
Depends on:
Blocks:
 
Reported: 2015-02-15 14:15 EST by Andrey Loskutov CLA
Modified: 2015-02-18 00:40 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 Andrey Loskutov CLA 2015-02-15 14:15:36 EST
I've started to check where the possible performance issues can be with 4.x, and the first thing I saw was the HUGE amount (~4000) of XmlEntityScanner$1 and same amount (~4000) of ClassNotFoundExceptions exceptions thrown just by navigating between editors.

Entry points:
com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(int, boolean, boolean) XMLEntityScanner.java:1767

com.sun.org.apache.xerces.internal.utils.ObjectFactory.findProviderClass(String, ClassLoader, boolean) ObjectFactory.java:209 

The exceptions aren't that problematic (just performance issue) but the actual issue I found was: WorkbenchPage.findEditor() performance is not nice if one has lot of not initialized editors (I had 30).

WorkbenchPage.findEditor() iterates over all editor references and for each reference calls EditorReference.getFactoryId(). EditorReference.getFactoryId() implementation works fine for already initialized editors, but makes lot of overhead for uninitialized ones: *each time* it is called it parses xml memento, which causes 2 exceptions per call and lot of XML parser overhead just to get a single string.

The patch follows.
Comment 1 Eclipse Genie CLA 2015-02-15 14:21:11 EST
New Gerrit change created: https://git.eclipse.org/r/41885
Comment 3 Sergey Prigogin CLA 2015-02-16 18:36:18 EST
Thank you, Andrey, for the fix.