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

Bug 349675

Summary: [EMF Runtime Extensions] Performance improvements of MetaModelDescriptorRegistry
Product: [Automotive] Sphinx Reporter: Robert Kiss <robert.kiss>
Component: CoreAssignee: Robert Kiss <robert.kiss>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3    
Version: 0.7.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
mylyn/context/zip idydieng: iplog+

Description Robert Kiss CLA 2011-06-17 07:59:30 EDT
Build Identifier: 

There are several performance improvements that can be performed quite easily on the MetaModelDescriptorRegistry:

1. getDescriptor(EPackage) and getDescriptor(URI) shall use a precompiled pattern for regexp.

2. Use LinkedHashMap instead of HashMap to keep the descriptor. In case of multiple descriptor the same performance will be obtained at each run.

3. Even if multiple descriptors are defined during a heavy computing user action only one or two descriptors are actually used. If those descriptors are the last in the hash a lot of cpu cycles are wasted. The proposal would be:
- each time getDescriptor(T mmDescriptor, IDescriptorFilter filter) is used and the returned descriptor is not the first in the list change the list by moving the found descriptor to the first position. This way the next call of the method, which probably will look for the same descriptor, will execute faster.

Reproducible: Always
Comment 1 Stephan Eberle CLA 2011-07-08 19:42:41 EDT
(In reply to comment #0)
Good ideas! I'm ok with all of them, they can be implemented right away.

@1. Note precompiled patterns must be used in this - rather non intuitive - way to be effective: 

  return Pattern.compile(descriptor.getEPackageNsURIPattern()).matcher(nsURI).matches()
Comment 2 Robert Kiss CLA 2011-07-12 07:37:42 EDT
I might have time to work on this in the July/August.
Comment 3 Robert Kiss CLA 2011-08-01 07:10:49 EDT
Resolved
Comment 4 Robert Kiss CLA 2011-08-01 07:10:51 EDT
Created attachment 200650 [details]
mylyn/context/zip
Comment 5 Balazs Grill CLA 2021-07-14 02:16:51 EDT
Mass-closing Resolved tickets