<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ModelItemCollection performance issues in Navisworks API Forum</title>
    <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/11485656#M3770</link>
    <description>&lt;P&gt;Hello 2018, 19 and 21.&lt;/P&gt;&lt;P&gt;Wwritting from 2022 here - soon to be 23 to provide further evidence or findings that may help others, or debuggers. The issue with an &lt;STRONG&gt;empty&lt;/STRONG&gt; iteration loop is very noticeable even with 'smaller' collections, around 80k take already several seconds to iterate. A couple other things I have noticed:&lt;/P&gt;&lt;P&gt;1. If one runs the iteration several time (iterate once, then again, then again) the time increases dramatically at each iteration&lt;/P&gt;&lt;P&gt;2. Because of #1, I tried using the first iteration to copy the collection to a standard list&amp;lt;modelitem&amp;gt; (CopyTo, AddRange and foreach all have the same delay), then iterate on that list instead. The copy obviously takes a long time still, but looping on the list after that is a couple &lt;STRONG&gt;milliseconds&lt;/STRONG&gt;. Yes that's right, &lt;STRONG&gt;milli&lt;/STRONG&gt;-seconds vs full-seconds.&lt;/P&gt;&lt;P&gt;3. On rare and seemingly random occasions, the loop will run in 1/10th of the time, still slow but certainly better (And I measure my words carefully here after literrally days of testing&amp;nbsp;and only a few occurances of that; on the same model, same search, same loop code (empty), clean run with navisworks restart each time).&lt;/P&gt;&lt;P&gt;4. That issue doesn't impact only iterations, native navisworks method using collection also become very slow, e.g. corruptedCollection.CopyTo(freshNewCollection) etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This led me to conclude that (1) there is a very big overhead on the modelitemcollection, and strangely enough it impacts the read (some marshalling issue?), and (2) that this overhead has some 'leak' that makes it worse and worse after each read. I am no further along making this more efficient but at least realising that the issue compounds on collection re-read, allowed me to switch to lists, run all the operations, and go back to collection only for Navisworks native operation that require collections, e.g. setting the Selection.&lt;BR /&gt;&lt;BR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/823624"&gt;@xiaodong_liang&lt;/a&gt;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5661631"&gt;@naveen.kumar.t&lt;/a&gt;&amp;nbsp;- has anyone from the dev team looked at this yet considering the number of people who experienced it and the time span of the issue?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 16 Oct 2022 05:14:21 GMT</pubDate>
    <dc:creator>ngombault</dc:creator>
    <dc:date>2022-10-16T05:14:21Z</dc:date>
    <item>
      <title>ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8071271#M3737</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm hitting serious performance issues with the ModelItemCollection class. I have a collection of about 270k items (so, big but not tremendously huge...). Just looping over the collection (with foreach) takes forever (several minutes!). I have tried converting the collection to a hashedSet and looping just flies (~1 millisec). Of course, converting takes ages too, so that is not a real solution...&lt;/P&gt;&lt;P&gt;Is there something big that I am missing? Or is it really the kind of performance I should expect from that type of collection?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 15:17:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8071271#M3737</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-15T15:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8071507#M3738</link>
      <description>&lt;P&gt;I don't think you're missing anything, it just takes longer for larger sets.&amp;nbsp; This could be due to the tree-based structure Navisworks uses for its data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Rather than processing one massive generic set and test/process for every object, you'll likely find it faster to first create smaller, selectively created sets first.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jun 2018 16:55:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8071507#M3738</guid>
      <dc:creator>dgorsman</dc:creator>
      <dc:date>2018-06-15T16:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8072449#M3739</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/253793"&gt;@dgorsman&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;I don't think you're missing anything, it just takes longer for larger sets.&amp;nbsp; This could be due to the tree-based structure Navisworks uses for its data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rather than processing one massive generic set and test/process for every object, you'll likely find it faster to first create smaller, selectively created sets first.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thanks for the reply, really. But, still, I need to understand a bit more... I don't see why the tree-based structure could impact the collection performance; in my case, the collection contains items and when I loop on them I do not use at all the parent-child relationship. I'm just looping on the list (the simplest test was just increasing a counter, so not even using the single item...).&lt;/P&gt;&lt;P&gt;About your suggestion, I could split it, but I need a reference figure then... What size should I use as the upper limit for my batch operations then? 1k?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note however that I still believe something is wrong here, anyway... 270k is not so huge in a list and this is confirmed by the fact that as HashedSet with the same items just flies. Any idea of what could explain this huge difference?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jun 2018 09:05:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8072449#M3739</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-16T09:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8072517#M3740</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Can you be a little bit more specific? It's not just looping, I suppose that you are taking those elements and doing some operations over. If you are additionaly looping through categories and properties, this is really slow, I asked the same questions on this forum without any answer</description>
      <pubDate>Sat, 16 Jun 2018 11:17:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8072517#M3740</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2018-06-16T11:17:02Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074144#M3741</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2454517"&gt;@rade_tomovic&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Can you be a little bit more specific? It's not just looping, I suppose that you are taking those elements and doing some operations over. If you are additionaly looping through categories and properties, this is really slow, I asked the same questions on this forum without any answer&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Well, of course in my orginal code I was doing several things; but then I focused on finding the main culprit of the performance issues so I started stripping down the code. The simplest test was really reduced to the following:&lt;/P&gt;&lt;PRE&gt;int tmpCounter = 0;
foreach (ModelItem currItem in itemList)
 tmpCounter++;&lt;/PRE&gt;&lt;P&gt;And this was taking an absurd amount of time... The same loop on a HashedSet was instantaneous.&lt;/P&gt;&lt;P&gt;I will try to simplify my code and see if it can be shared, so maybe you can run the same tests if you care.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 07:14:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074144#M3741</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-18T07:14:13Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074207#M3742</link>
      <description>Ok, I haven't noticed issues like that while simple looping through model items. But maybe this hint will help you - you need (very probably) just items which have GUIDs (which means, at least for Revit based models - instances) so add one IF clause just after loop where you'll check that item GUID is different from empty GUID.</description>
      <pubDate>Mon, 18 Jun 2018 07:59:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074207#M3742</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2018-06-18T07:59:02Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074241#M3743</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2454517"&gt;@rade_tomovic&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Ok, I haven't noticed issues like that while simple looping through model items. But maybe this hint will help you - you need (very probably) just items which have GUIDs (which means, at least for Revit based models - instances) so add one IF clause just after loop where you'll check that item GUID is different from empty GUID.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;This is interesting... the lack of a general notion of GUID is exactly why I'm writing my code... I do not have Revit projects, but data coming from several other CAD packages, GUIDs are always empty; and there is no field that can serve as a Unique ID. So, I need to create one myself (by adding custom props).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I've just simplified my code and reduced to a Debug button that calls this:&lt;/P&gt;&lt;PRE&gt;// get the selected items
Document oDoc = Autodesk.Navisworks.Api.Application.ActiveDocument;
ModelItemCollection itemList = oDoc.CurrentSelection.ToSelection().GetSelectedItems();

MessageBox.Show("Total selected items: " + itemList.Count.ToString());
System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
timer.Start();

int tmpCounter = 0;
foreach (ModelItem currItem in itemList)
   tmpCounter++;

long t1 = timer.ElapsedMilliseconds;
MessageBox.Show("Time to loop list of all items:  " + t1.ToString() + " milliseconds");&lt;/PRE&gt;&lt;P&gt;As long as I have a few thousands selected items, this eats up seconds. Which, to me, seems really too much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 08:15:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074241#M3743</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-18T08:15:50Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074268#M3744</link>
      <description>There must be some GUID - try to change selection resolution in the interface. If those elements came from CAD, try to set selection resolution to geometry and see if there are GUIDs under Item/GUID. If not, try to cycle through different selection resolutions until you see GUID</description>
      <pubDate>Mon, 18 Jun 2018 08:27:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074268#M3744</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2018-06-18T08:27:57Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074306#M3745</link>
      <description>&lt;P&gt;GUIDs in these large industrial projects are only at the file level. Quite useless as any file has thousands of items...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jun 2018 08:47:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8074306#M3745</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-18T08:47:10Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8081769#M3746</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4214944"&gt;@luca_vezza&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it is weird behavior&amp;nbsp;as you did nothing in foreach on a small tree. And it seems you only dumped a selected item, which means the items are much less. Is such code working well with some other small files (such as SDK sample gatehouse.nwd, clashtest.nwd etc)? I'd think it will need a&amp;nbsp;reproducible sample file to diagnose further.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As to guid, I guess you talked about the guid property with ModelItem API object. It is auto-assigned when Navisworks imports the file, but not all types of file have such id value. While as&amp;nbsp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2454517"&gt;@rade_tomovic&lt;/a&gt;&amp;nbsp;mentioned, no matter any file format, it should be a kind of unique id in the object properties, e.g.Entity Handle of AutoCAD, unique id/&amp;nbsp;element id of Revit etc.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Jun 2018 03:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8081769#M3746</guid>
      <dc:creator>xiaodong_liang</dc:creator>
      <dc:date>2018-06-21T03:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8085731#M3747</link>
      <description>&lt;P&gt;Hi Xiaodong,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/823624"&gt;@xiaodong_liang&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;it is weird behavior&amp;nbsp;as you did nothing in foreach on a small tree. And it seems you only dumped a selected item, which means the items are much less. Is such code working well with some other small files (such as SDK sample gatehouse.nwd, clashtest.nwd etc)? I'd think it will need a&amp;nbsp;reproducible sample file to diagnose further.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;It seems to work fine (meaning the perfomance is not an issue) for small collections in general, but this is simply because the issue is there but smaller, harder to perceive... So try it on any file and you should get the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;As to guid, I guess you talked about the guid property with ModelItem API object. It is auto-assigned when Navisworks imports the file, but not all types of file have such id value. While as&amp;nbsp;&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2454517"&gt;@rade_tomovic&lt;/a&gt;&amp;nbsp;mentioned, no matter any file format, it should be a kind of unique id in the object properties, e.g.Entity Handle of AutoCAD, unique id/&amp;nbsp;element id of Revit etc.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;The files we work with come from CAD systems such as Catia, AVEVA PDMS and Intergraph. All these files do not show usable GUIDs on the items, unfortunately.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 15:28:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8085731#M3747</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-06-22T15:28:55Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8103542#M3748</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4214944"&gt;@luca_vezza&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;regarding with guid per object, I checked with our engineer team and got the comments below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What IDs are available depend on the file format you’re loading into Navisworks. Some file formats don’t have any per objects ids, some have ids but they aren’t stable (edit the file in some unrelated way and the ids change). Most of these ids are only unique within a file. Whatever ids are there show up as object properties which are different depending on format – Entity Handle for Autocad, Element Id for Revit, etc.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In addition Navisworks has support for a per object GUID which is a stable, globally unique id for an object. GUIDs exist for file formats which directly support GUIDs (e.g. IFC) and for some file formats where we can generate stable, globally unique ids based on the file format specific ids. This includes AutoCAD and Revit but not Catia, PDMS or Integraph. So, for such file formats:&amp;nbsp; you&amp;nbsp;would have to rely on custom properties that the creator of the design file has setup.&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 03:10:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8103542#M3748</guid>
      <dc:creator>devtechchina</dc:creator>
      <dc:date>2018-07-02T03:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8191696#M3749</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4214944"&gt;@luca_vezza&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hi Xiaodong,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/823624"&gt;@xiaodong_liang&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;it is weird behavior&amp;nbsp;as you did nothing in foreach on a small tree. And it seems you only dumped a selected item, which means the items are much less. Is such code working well with some other small files (such as SDK sample gatehouse.nwd, clashtest.nwd etc)? I'd think it will need a&amp;nbsp;reproducible sample file to diagnose further.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;It seems to work fine (meaning the perfomance is not an issue) for small collections in general, but this is simply because the issue is there but smaller, harder to perceive... So try it on any file and you should get the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Still on the ModelItem collection performance issue...&lt;/P&gt;&lt;P&gt;I see that the Task manager shows a high number of page faults when the code loops on the collection. And the app's private working set keeps on reducing, as if the system (or the Garbage Collector) decided to move the items' details away from the main memory. If that is the case, accessing them would cause the page fault and, to retrieve the data, extra processor cycles would certainly be needed. This could potentially explain the very poor performance.&lt;/P&gt;&lt;P&gt;Is there a way to force Navisworks to keep the items info in memory until we're done looping on the collection? (Note that physical RAM is not an issue, there is a lot available...).&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 Aug 2018 14:19:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8191696#M3749</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-08-10T14:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8409060#M3750</link>
      <description>&lt;P&gt;I would suggest to use the ComAPI, converting your&amp;nbsp;ModelItemCollection once.&lt;/P&gt;&lt;P&gt;Using this method I'm able to parse depth first a model with around half million objects in less than a second on a&amp;nbsp;typical laptop, including accessing each object name.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var nwSel = ComApiBridge.ToInwOpSelection(items); // items is your original ModelItemCollection
var nwItems = nwSel.Paths();
int c = nwItems.Count;&lt;BR /&gt;for (int i=1;i&amp;lt;=c;i++)
{
    var path = (InwOaPath3)nwItems[i];
    var node = (InwOaNode)path.Nodes().Last();
    // do your stuff here using node&lt;BR /&gt;    // examples: node.UserName, node.IsLayer, etc...
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Nov 2018 16:03:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8409060#M3750</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-18T16:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8413905#M3751</link>
      <description>&lt;P&gt;Wow, that sounds interesting. I will give it a try asap and get back to you.&lt;/P&gt;
&lt;P&gt;By the way, any idea if/where one could find a decent doc for the COM API?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a bunch,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 16:11:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8413905#M3751</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-11-20T16:11:24Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8413974#M3752</link>
      <description>&lt;P&gt;Just iterating through ModelItemCollection is not performance issue (simple O(n) for enough items). Performance starting to be a huge problem when you try to get properties, because time complexity is going to O(n^3) one loop for items, one for categories and one for properties.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Nov 2018 16:36:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8413974#M3752</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2018-11-20T16:36:12Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8415681#M3753</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2454517"&gt;@rade_tomovic&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Just iterating through ModelItemCollection is not performance issue (simple O(n) for enough items). Performance starting to be a huge problem when you try to get properties, because time complexity is going to O(n^3) one loop for items, one for categories and one for properties.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I wish that was true... but apparently in my case even just looping eats up a lot of time. See posts above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Luca&lt;/P&gt;</description>
      <pubDate>Wed, 21 Nov 2018 09:04:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8415681#M3753</guid>
      <dc:creator>luca_vezza</dc:creator>
      <dc:date>2018-11-21T09:04:30Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420684#M3754</link>
      <description>&lt;P&gt;&lt;SPAN&gt;It's true that iterating over properties for each items greatly increase running time.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However theoretically it's not O(n^3)&amp;nbsp; but O(n x categories x properties) provided the access to the categories for one item below the hood is direct.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As real case example, in my plugin, I can iterate through over a quarter million items in 0.6s but it take around 7s to get all their "static" [aka not the GUI custom one] SP3D properties using ComApi. Still acceptable but not so "yahoo" !&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In my case almost all items are from SP3D so have lots of SP3D properties as strings, this explaining that...&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;For reference simplified code extract on how I access these whi "node" being the ComApi node of concern:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;			InwOpState11 state = (InwOpState11)ComApiBridge.State;
			InwNodeAttributesColl attrs = node.Attributes();
			InwOaAttribute attr = null;

			var cc = attrs.Count;
			for (int i = 1; i &amp;lt;= cc; i++)
			{
				attr = attrs[i] as InwOaAttribute;

				if (attr.ClassName != "SP3D")
					continue;

				InwOaPropertyVec propVec = state.GetAttributeProperties(attr);
				InwOaPropertyColl props = propVec.Properties();
				int pc = props.Count;

				for (int j = 1; j &amp;lt;= pc; j++)
				{
					InwOaProperty prop = (InwOaProperty)props[j];
					PropertiesIndexes idx;

					// do your stuff here using prop.value;
				}

				GC.KeepAlive(props);
				GC.KeepAlive(propVec);
			}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:01:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420684#M3754</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-23T14:01:12Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420719#M3755</link>
      <description>&lt;P&gt;Yeah, techically it is O(nxmxp), however it is really slow. I developed plugin for grouping model into tree, based on custom properties and for that purposes I have to iterate through every item/category/property/value and for models larger than 100k it can take a few minutes (especially for complex BIM projects where you have a hundreds of properties). I’m not sure that COM API is faster than .NET in that case, but please advise if you have different experience.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:18:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420719#M3755</guid>
      <dc:creator>rade_tomovic</dc:creator>
      <dc:date>2018-11-23T14:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: ModelItemCollection performance issues</title>
      <link>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420731#M3756</link>
      <description>&lt;P&gt;I have not instrumented the specific performance difference to access categories and properties between ComApi and .NET, however&amp;nbsp;my gut feeling is a 3x speed-up&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;Depending on your use case, you can speed up things by skeeping categories you don't want or have already listed&lt;/P&gt;
&lt;P&gt;Same for the properties.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There is one critical semantic difference between .NET and ComAPI categories:&lt;/P&gt;
&lt;P&gt;- .NET API merge the "static" and the "custom GUI" properties&lt;/P&gt;
&lt;P&gt;- ComAPI has 2 different APIs to access these&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;While this would seems .NET API is at an advantage here in terms of writing simpler code, I would argue this is actually the opposite !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using ComAPI you have some control of what you parse and this can give you a up to 10x performance improvement if you know which type of category [Custom GUI or "static") you are looking at.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Nov 2018 14:27:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/navisworks-api-forum/modelitemcollection-performance-issues/m-p/8420731#M3756</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-11-23T14:27:26Z</dc:date>
    </item>
  </channel>
</rss>

