Bug 120106

Summary: [ServiceProviders] Improve performance of AbstractProviderConfiguration
Product: [Modeling] GMF-Runtime Reporter: Keith W. Campbell <keithc>
Component: GeneralAssignee: Anthony Hunter <ahunter.eclipse>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 Keywords: performance
Version: 1.0   
Target Milestone: 2.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
proposed patch none

Description Keith W. Campbell CLA 2005-12-09 10:11:17 EST
I have a patch that improves the space and time characteristics of
AbstractProviderConfiguration. The hilights follow.

+ Merged isAssignableTable and isNotAssignableTable into assignableMap. This
  reduces the space required to cache whether classes are assignable to named
  types. Fewer operations are required to query or update the new map. As well
  we only gather information about classes directly given to isAssignableTo();
  this avoids the space wasted by caching information about interfaces and
  other classes that are not of interest to clients of the API.

+ Inlined behavior of classes ClassToMethodSignaturesSetMap and
  ClassToMethodSignatureToMethodCach into a single map (methodCache) in
  ObjectDescriptor. This reduces the number of classes and objects required
  and improves performance as above as there is now a single path to discover
  a method or that it does not exist.

+ Changed type of ObjectDescriptor.methods and ObjectDescriptor.staticMethods
  to MethodValueEntry[]. This eliminates two objects per descriptor, eliminates
  frequent casts and improves performance.

+ Fix possible NullPointerException in ObjectDescriptor.sameAs() if parameter
  is null.

+ Refactored execution into MethodDescriptor and StaticMethodDescriptor reducing
  need for recursion and eliminating many casts.

+ Introduced SimpleParser to aid in parsing method and value descriptors.

+ Removed MethodDescriptor.parameters it was only used within the constructor.

+ Changed MethodDescriptor.signature to that it refers to an instance of a new
  class that is more space- and time-efficient than a string representation of
  the method's signature.

+ Refactored the constructors of MethodDescriptor and StaticMethodDescriptor
  to eliminate much common code which now lives in setParameterAndType().

+ Removed many unused getters and setters. Then removed unused fields.

+ Avoid cloning parameterObjects in StaticMethodDescriptor when there are no
  'contest' parameters?

+ Merged ValueDescriptor.valueLiterals and ValueDescriptor.notValueLiterals
  into a single map (valueMap) requiring at most one lookup in sameAs() and
  reducing the number of objects. Collections.singletonMap is used in the
  common case where this exactly one value.

+ Changed type of ValueDescriptor.valueObjects and
  ValueDescriptor.notValueObjects to ObjectDescriptor[]. This eliminates two
  objects per descriptor, eliminates frequent casts and improves performance.

+ Merged successLookupTable and failureLookupTable into a single map
  (loadedClassMap) reducing the number of lookups required in loadClass()
  and reducing the number of objects. We also avoid constructing the large
  String keys and instead use the existing class name and plugin id.
Comment 1 Keith W. Campbell CLA 2005-12-09 10:12:41 EST
Created attachment 31469 [details]
proposed patch
Comment 2 Keith W. Campbell CLA 2005-12-09 10:13:21 EST
Added 'performance' keyword.
Comment 3 Mohammed Mostafa CLA 2006-08-22 13:40:34 EDT
due to the amount of changes in this patch, i think it should be push to 2.0
unless we have concrete numbers showing big impact on performance 
Comment 4 Anthony Hunter CLA 2007-06-19 12:09:08 EDT
Moving to the next release, GMF 2.1. 
Comment 5 Eclipse Webmaster CLA 2010-07-19 21:57:21 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug