<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta content="text/html; charset=utf-8">
</head>
<body>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12.0pt; line-height:1.3; color:#1F497D">
<div>We do this very similarly in 3D Slicer, too: we very rarely iterate through VTK collections but we use STL maps, deques, sets, etc. to keep track of groups of VTK objects.<br>
<br>
There is no need to hypothesize about what performance degradation collections may cause because we can find performance bottlenecks much more efficiently by profiling.<br>
<br>
What I usually see on Windows is that polydata algorithms tends to spend a lot of time (few ten percent) doing elementary data access operations, such as getting and setting point coordinates. So, some tricks to speed that up could make a difference. The abstraction
layer that was added to allow storing data using arbitrary memory layout seemed to decrease performance, too (by about 5-10%). While visualizing image slices of volumes using OpenGL2 backend + Qt5 appears to be slowed down by some OpenGL texture operations,
which results in 10-20% lower refresh rates compared to the old OpenGL backend. Has anyone else found these same performance bottlenecks while profiling VTK-based applications?
<br>
</div>
<div><br>
</div>
<div id="signature-x" class="signature_editor" style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12.0pt; color:#1F497D">
Andras<br>
<br>
</div>
</div>
<div id="quoted_header" style="clear:both">
<hr style="border:none; height:1px; color:#E1E1E1; background-color:#E1E1E1">
<div style="border:none; padding:3.0pt 0cm 0cm 0cm"><span style="font-size:11.0pt; font-family:'Calibri','sans-serif'"><b>From:</b> Todd Martin via vtk-developers <vtk-developers@public.kitware.com><br>
<b>Sent:</b> Thursday, December 13, 2018 6:19 PM<br>
<b>To:</b> Elvis Stansvik; David Gobbi<br>
<b>Cc:</b> VTK Developers<br>
<b>Subject:</b> Re: [vtk-developers] Better than O(n) prop operations on vtkRenderer<br>
</span></div>
</div>
<br type="attribution">
<div>
<div class="ydp75171053yahoo-style-wrap" style="font-family:Helvetica Neue,Helvetica,Arial,sans-serif; font-size:16px">
<div>
<div>My solution to this kind of problem in the past has been to build a (non-clustered) sorted index for fast lookup on the collection, without changing the underlying collection itself. In fact multiple indicies could be built and (if desired) attached to
the collection in a list. Of course it means that each index needs to be rebuilt, when anything is added to or removed from the collection. The most efficient way to do that is to set a flag when anything changes and then only rebuild the index the next time
it is accessed.<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div class="ydp75171053signature">
<div style="font-size:16px; font-family:Helvetica,Arial,sans-serif">
<div>Todd Martin, PhD.<br>
</div>
<div><i>Freelance Engineer/Software Architect.</i></div>
<br>
</div>
</div>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<div id="yahoo_quoted_5635360879" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; color:#26282a">
<div>On Friday, 14 December 2018, 12:06:59 PM NZDT, David Gobbi <david.gobbi@gmail.com> wrote:
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div id="yiv7840540130">
<div>
<div dir="ltr">Hi Elvis,
<div><br clear="none">
</div>
<div>I don't think there are any fans of vtkCollection, but replacing it</div>
<div>with something modern would be lot of work and would provide</div>
<div>far less benefit than e.g. the recent reworking of the VTK data</div>
<div>arrays to provide flexible memory access patterns.</div>
<div><br clear="none">
</div>
<div>Also, given the cost for vtkRenderer to render a bunch of props,</div>
<div>you would have to be doing many hundreds (thousands?) of</div>
<div>insertions/removals per render before the time required for those</div>
<div>operations becomes significant to overall app performance.</div>
<div><br clear="none">
</div>
<div> David</div>
<div><br clear="none">
</div>
<div><br clear="none">
<div class="yiv7840540130gmail_quote">
<div class="yiv7840540130yqt6418243541" id="yiv7840540130yqtfd14644">
<div dir="ltr">On Thu, Dec 13, 2018 at 3:33 PM Elvis Stansvik <<a rel="nofollow" shape="rect" target="_blank" href="mailto:elvis.stansvik@orexplore.com">elvis.stansvik@orexplore.com</a>> wrote:<br clear="none">
</div>
<blockquote class="yiv7840540130gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
Hi all,<br clear="none">
<br clear="none">
The props of a vtkRenderer are kept in a vtkCollection (and probably<br clear="none">
have been since VTKs childhood), meaning linear time<br clear="none">
search/insert/remove.<br clear="none">
<br clear="none">
I realize the use of vtkCollection is pervasive in these classes, and<br clear="none">
also shines through in their API, so this is a bit of a long shot,<br clear="none">
but, is there any chance that it'll at some point be converted to use<br clear="none">
a sorted data structure, to permit logarithmic operations?<br clear="none">
<br clear="none">
Has anyone else had the need to rapidly insert/remove/check for props<br clear="none">
in a renderer with a large amounts of props in it? Has the idea of<br clear="none">
having vtkRenderer backed by something else been discussed before?<br clear="none">
<br clear="none">
Cheers,<br clear="none">
Elvis<br clear="none">
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="yqt6418243541" id="yqtfd79468">_______________________________________________<br clear="none">
Powered by www.kitware.com<br clear="none">
<br clear="none">
Visit other Kitware open-source projects at <a shape="rect" href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.kitware.com%2Fopensource%2Fopensource.html&data=02%7C01%7Classo%40queensu.ca%7C61d78fa19d324baf82eb08d661517616%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636803399838921389&sdata=3o5i7hDrznYn3%2FNCY5pUNpLuW7xzF4x2A0giA6Vq72U%3D&reserved=0" originalsrc="http://www.kitware.com/opensource/opensource.html" shash="iatsX4PiXRAw6yhudSVhhnE80rvm0W5MnSdLrc7NCNzg4l4bURgJhfNPJV892HO6BuFKvBIEbiqKI1tMDWw0GCTeFPHLkMtIm5Nz429cme3osGveRaBB96D5oMpLPDiXt4DR+wNAOzDYnRJwOSCERDqzXxdToRnqABECU5Wv90c=" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br clear="none">
<br clear="none">
Search the list archives at: <a shape="rect" href="https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmarkmail.org%2Fsearch%2F%3Fq%3Dvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C61d78fa19d324baf82eb08d661517616%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636803399838921389&sdata=vAxn%2BGTmCoOhD1X0oSuSEGuYI6F5J7faOb%2B5m3JWdmo%3D&reserved=0" originalsrc="http://markmail.org/search/?q=vtk-developers" shash="z8EJx/bZEWjOHGvw9qoeKewdUscft88M6OCsaILcaO31bUpwL2sIDIlErtWlL0Ht8oTUZcvCoGoHBsbk8mxficvsuUWR8bdnJrS/wYEGiMdskYsBIpPmZmyKO0SokokePzyuSV/n0f4xlN+Sg4IawOEBC69otRztCrnrMePXBc0=" target="_blank">
http://markmail.org/search/?q=vtk-developers</a><br clear="none">
<br clear="none">
Follow this link to subscribe/unsubscribe:<br clear="none">
<a shape="rect" href="https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpublic.kitware.com%2Fmailman%2Flistinfo%2Fvtk-developers&data=02%7C01%7Classo%40queensu.ca%7C61d78fa19d324baf82eb08d661517616%7Cd61ecb3b38b142d582c4efb2838b925c%7C1%7C0%7C636803399838931389&sdata=2Xf3v7M4Szs4q%2BjbtTxvB4%2Fihx6u%2F9wNiiYpKPwub74%3D&reserved=0" originalsrc="https://public.kitware.com/mailman/listinfo/vtk-developers" shash="hxjwfJ48MSnWZ1IV51L0xEE80LoreDq1uylKBwvYDPXqb9eq/j6gk+tKywU0vD0qtfFTx4dxEjBSlttT5eNSQLaSaXK9GEC1reVtAbzSsiGWiqrULYM0qkuVuY7UhkMpg4EO60L+HaICg4xhxA9dTjdeI6YYDszZmYpMIvVuHuY=" target="_blank">https://public.kitware.com/mailman/listinfo/vtk-developers</a><br clear="none">
<br clear="none">
</div>
</div>
</div>
</div>
</div>
</body>
</html>