Bug 91716

Summary: [prefs] Too many calls to EclipsePreference#get while scanning full workspace units
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: CoreAssignee: Frederic Fusier <frederic_fusier>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 Keywords: performance
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Frederic Fusier CLA 2005-04-18 04:06:54 EDT
Running performance test FullSourceWorkspaceASTTests#testWkspDomAstCreationJLS2,
it appears that around 26,000,000 calls to EclipsePreference#get are done.

This can be improved greatly by caching option of IJavaProject which will avoid
to ask many times JavaCore options and compute map of project options.
Comment 1 Frederic Fusier CLA 2005-04-18 12:38:11 EDT
Fixed and released in HEAD.

No specific test case added as this optimization is verified by performance
tests FullSourceWorkspaceSearchTests#testIndexing and
FullSourceWorkspaceASTTests#testDomAstCreationJLS2.
Comment 2 Tod Creasey CLA 2005-04-18 15:17:43 EDT
Do you have any idea of how many calls are saved?
Comment 3 Frederic Fusier CLA 2005-04-19 04:43:34 EDT
yes.
In Eclipse 3.0 full source workspace, there are 57 projects, 9402 units and each
java project has 336 options set.
In this test all units are parsed and 2 getOptions(boolean) is called per
project. Without optimization, getOptions(boolean) calls EclipsePreferences#get
twice per option. So, we got exactly 9402 x 2 x 336 x 2 = 12,636,288 calls.
Finally we have to multiply these calls by 2 as indexer was also running while
executing this test =>  25,272,576 calls.

With the optimization, getOptions(boolean) calls twice EclipsePreferences#get
method for each option only once per project. That means that number of calls is
now 57 x 336 x 2 = 38,304 calls
=> 25,234,272 calls are saved in this test case...
Comment 4 Olivier Thomann CLA 2005-05-12 14:25:23 EDT
Could not be verified.
Performance tests are ok.
Verified in I20050510-0010 + JDT/Core v_556
Comment 5 Maxime Daniel CLA 2005-05-13 04:42:23 EDT
Verified for 3.1 M7 using build I20050512-2035 + jdt.core HEAD.
(Traced a gain 10602292 -> 60076 on org.eclipse.jdt.core.tests.dom.RunAllTests.)