Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 330302

Summary: Reduce the number of calls to WorkspaceContextResolver for a resource of a given structured doc context
Product: [WebTools] Java Server Faces Reporter: Carlin Rogers <carlin.rogers>
Component: CoreAssignee: Carlin Rogers <carlin.rogers>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: raghunathan.srinivasan, yurykats
Version: 3.2.2   
Target Milestone: 3.2.3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 330303    
Attachments:
Description Flags
patch to reduce number of calls to ModelManagerImpl none

Description Carlin Rogers CLA 2010-11-15 19:31:58 EST
In profiling, I found that during validation we spend quite a bit of time repeatedly calling the WorkspaceContextResolver to get the resource associated to the IStructuredDocumentContext for the page being validated... via the AttributeValidatingStrategy. The main cost of WorkspaceContextResolver getProject() and getResource() is a call into ModelManagerImpl.getExistingModelForRead() which manages access to shared objects, taking locks, and checking model state. The ModelManagerImpl routine iterates through all known shared model objects (even across projects) trying to find one with a structured doc matching the one we're looking for.

For 3.2.3 we can put in some code changes to improve the implementation of WorkspaceContextResolver and routines that call it to reduce the number of calls made to ModelManagerImpl.

I will also clone this for a separate bug for Indigo to make additional changes to cache or or get the resource associated to the IStructuredDocumentContext to reduce the number of times we have to call the WorkspaceContextResolver.
Comment 1 Carlin Rogers CLA 2010-11-16 14:10:19 EST
Created attachment 183258 [details]
patch to reduce number of calls to ModelManagerImpl

This patch reworks WorkspaceContextResolver as well as two classes that call this class to reduce the total number of calls to the ModelManagerImpl.

Results for the number of calls to ModelManagerImpl from two scenarios:
- import a JSF and JSTL project which contains 40 JSP (requiring validation of all pages in project). The pages have approx 50+ expressions and more than 150 attributes total in the tags of a given page.
  before - 60,182 
  after - 26,988

- opening one of the pages in the WPE.
  before - 9,224
  after - 3,616

Additional improvements can go into 3.3 and will be tracked in bug 330303.
Comment 2 Yury Kats CLA 2010-11-16 14:27:58 EST
Great improvements, thanks on investigating them!
Comment 3 Carlin Rogers CLA 2010-11-18 02:21:33 EST
Committed changes for 3.2.3 release.