Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 351759 - [Serializer] performance leak due to inefficient INodes navigation in NodeIterator
Summary: [Serializer] performance leak due to inefficient INodes navigation in NodeIte...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-11 17:06 EDT by Wladimir Safonov CLA
Modified: 2017-09-19 17:46 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
Using INodes methods for obtaining next/prev/first/last siblings (2.71 KB, patch)
2011-07-11 17:06 EDT, Wladimir Safonov CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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