| Summary: | [Performance] NameSimilarity.pairs should use Set implementation instead of List | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMFCompare | Reporter: | Cedric Brun <cedric.brun> | ||||
| Component: | Core | Assignee: | EMF Compare <emf.compare-inbox> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 1.2 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Cedric Brun
Hum, just launching the tests it looks like this tiny change, as I was frightened of, has huge effect and lead to 4 failling tests in the matching set. Checking through it, it was only "thresolds" effects. Indeed the change affect the absolute values returned by the matchs (and so the way elements are matched at some point), but *probably* for the better. Created attachment 200890 [details]
mylyn/context/zip
adding the mylyn context
commited and pushed on branches 1.2 and master. Reopening, other tests we did add in the meantime are failling. Other option : keeping the lists (and the former behavior) but making sure we will do the retainAll faster ! I have a fix keeping the exact same behavior as before but 5 times faster. (Coming soon in your git repository ;) )
While profiling I also saw : org.eclipse.emf.compare.util.ModelUtils.contains(Resource, EObject) which looked, at first, a quite dumb implementation (trying to find if an EObject is in a Resource by iterating over all the resource content) . Thinking a bit more about it, it's in fact done this way to handle fragmented resources. Clearly not the most efficient way to do but providing a more efficient way is not that trivial. Anyway this method can be speeded up with an extra check at the beginning :
public static boolean contains(Resource resource, EObject eObject) {
if (eObject.eResource() == null)
return false;
final TreeIterator<EObject> contentsIterator = resource
.getAllContents();
In case the eObject has no resource, we have very little chance to find it back in a Resource ;)
Doing so I did improve the performance of using EMF compare as a framework (It's not going to happen when using the Workspace actions)
pushed and fixed in both 1.2 and master. |