Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316793 - Use of ArrayList in ModelParameterExtent causes scalability issues
Summary: Use of ArrayList in ModelParameterExtent causes scalability issues
Status: RESOLVED FIXED
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-14 13:48 EDT by Alan McMorran CLA
Modified: 2013-04-03 11:51 EDT (History)
2 users (show)

See Also:


Attachments
Changes the getContents() method of ModelParameterExtent to use HashSets (1.57 KB, patch)
2010-06-14 13:49 EDT, Alan McMorran CLA
no flags Details | Diff
Updated version of patch (3.82 KB, patch)
2013-03-21 11:55 EDT, Sergey Boyko CLA
serg.boyko2011: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alan McMorran CLA 2010-06-14 13:48:09 EDT
Build Identifier: 20091217-0918

In the org.eclipse.m2m.internal.qvt.oml.ast.env.ModelParameterExtent class in the getContents() method the allRootObjects variable is set as an ArrayList which causes significant performance issues for the section of code:

for (EObject obj : inMemoryResource.getContents()) {
	// don't forget about UML stereotype applications which are the root objects
	if (obj.eContainer() == null && allRootObjects.contains(obj) == false) {
		allRootObjects.add(obj);
	}
}

when the number of root objects increases to several hundred thousand.  The contains method in ArrayList does not scale well, so it may be better to have these collections be HashSets (or similar) so that this comparison can be done quickly when the number of objects produced is in the order of several hundred thousand.

This may cause issues for object ordering, which doesn't affect my transform however.

Reproducible: Always
Comment 1 Alan McMorran CLA 2010-06-14 13:49:56 EDT
Created attachment 171853 [details]
Changes the getContents() method of ModelParameterExtent to use HashSets
Comment 2 Sergey Boyko CLA 2013-03-21 11:55:29 EDT
Created attachment 228860 [details]
Updated version of patch

For testing the following transformation was used:

  modeltype Ecore uses ecore('http://www.eclipse.org/emf/2002/Ecore');
  transformation NewTransformation1(in input : Ecore, out output : Ecore);
  main() {
    var index := 0;
    while (index < 100000) {
      object EClass {name := "n" + index.toString()};
      index := index + 1; 
    }
  }

With the proposed patch execution time of method EvaluationUtil.createEvaluationResult() reduced from 4054ms to 86ms.
Comment 3 Sergey Boyko CLA 2013-04-03 11:51:18 EDT
Pushed to master for Kepler M7.

Commit ID: f29c4a7c64cc0133dd1abb45a547eae8244dc498