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

Bug 351759

Summary: [Serializer] performance leak due to inefficient INodes navigation in NodeIterator
Product: [Modeling] TMF Reporter: Wladimir Safonov <wladimir.safonov>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: moritz.eysholdt, sebastian.zarnekow
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Using INodes methods for obtaining next/prev/first/last siblings sven.efftinge: iplog+

Description Wladimir Safonov CLA 2011-07-11 17:06:31 EDT
Created attachment 199451 [details]
Using INodes methods for obtaining next/prev/first/last siblings

Apparently migration to the new INodes API introduced a considerable performance leak in the class org.eclipse.xtext.parsetree.reconstr.impl.NodeIterator. In several places it makes use of the Lists.newArrayList(Iterable<INode>) to create a list of child nodes where eventually only one element will be picked up. This causes all children to be iterated through and collected in a new list. However dedicated methods on the INode can deliver the element of interest in one single get operation.

I attached a patch, which reduced serialization time for my model from 30 sec down to approx 2 sec. The model has a simple containment tree without any cross-references and has ~5 elements depth, but ~9K elements breadth, which is probably the reason of why iterations through the nodes take most of the serialization time.
Comment 1 Sebastian Zarnekow CLA 2011-07-12 02:46:41 EDT
Thanks for the report and the patch. We'll look into it.
Comment 2 Moritz Eysholdt CLA 2011-07-12 07:49:01 EDT
patch applied and pushed to master. Thx Wladimir.

In case we decide to implement bug 351822, we can deprecate this NodeIterator and use org.eclipse.xtext.nodemodel.util.NodeTreeIterator instead.
Comment 3 Karsten Thoms CLA 2017-09-19 17:35:08 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:46:13 EDT
Closing all bugs that were set to RESOLVED before Neon.0