<div dir="ltr">This came up once before.<div><br><div>The values selection extraction code path was optimized for the use case of extracting relatively long lists of values. Before doing the seek it sorts the data and the list. The sort is slow, but once done, the seek is fast and with a long list the cost is amortized and you end up winning overall. With a small list you don&#39;t.</div>

<div><br></div><div>The thresholds code path wasn&#39;t optimized, so for small lists it is faster.</div><div><br></div></div></div><div class="gmail_extra"><br clear="all"><div>David E DeMarle<br>Kitware, Inc.<br>R&amp;D Engineer<br>

21 Corporate Drive<br>Clifton Park, NY 12065-8662<br>Phone: 518-881-4909</div>
<br><br><div class="gmail_quote">On Mon, Feb 25, 2013 at 11:48 AM, Favre  Jean <span dir="ltr">&lt;<a href="mailto:jfavre@cscs.ch" target="_blank">jfavre@cscs.ch</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
Dear list<br>
<br>
I need to extract subsets of an unstructured grid, based on a cell-based material id (an integer).<br>
<br>
I use the following:<br>
<br>
selectionNode-&gt;SetFieldType(vtkSelectionNode::CELL);<br>
selectionNode-&gt;SetContentType(vtkSelectionNode::THRESHOLDS);<br>
<br>
and a vtkDoubleArray with two tuples, holding the same value as min and max, equal to my material id.<br>
<br>
this works fine and is quite fast. However, I thought it should be even faster, not having to threshold between a min and max values which, in this case, are equal, and to instead directly select by the integer value.<br>


<br>
So I changed the code to use a vtkIntArray with 1 tuple equal to the material id, and changed my selectionNode:<br>
selectionNode-&gt;SetContentType(vtkSelectionNode::VALUES);<br>
<br>
this new version produces the correct and identical selection as the first version, but the execution times is 20 seconds vs. 0.16 seconds. This is a huge difference and I&#39;d like to have some insight about it. Why should value-based selection be so much slower? This small test only has 80k cells. [My real data has 10+ million cells, :-( ]<br>


<br>
I took the example benchmark in <a href="http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelectionCells" target="_blank">http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/ExtractSelectionCells</a>, and modified it to test, so I can share the updated benchmark.<br>


<br>
-----------------<br>
Jean/CSCS<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>