<div dir="ltr">Hi, <div><br></div><div>> <span style="font-size:12.8000001907349px">Do I have any options other than parallelizing the main loop?</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">yes, you do, but it will complicate your resource (memory) management</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">basically, separate allocation and initialization and use placement new</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">somewhere along the line</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">auto shex = sizeof(</span><span style="font-size:12.8000001907349px">vtkHexahedron</span><span style="font-size:12.8000001907349px">);</span></div><div><span style="font-size:12.8000001907349px">auto elems_mem = new char [</span><span style="font-size:12.8000001907349px">numElems * shex</span><span style="font-size:12.8000001907349px">];</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"> for(int i = 0; i < numElems; ++i) {</span><br style="font-size:12.8000001907349px"><span style="font-size:12.8000001907349px"> elems[i] = new (</span><span style="font-size:12.8000001907349px">elems_mem + i*</span><span style="font-size:12.8000001907349px">shex</span><span style="font-size:12.8000001907349px">) vtkHexahedron();</span></div><div><span style="font-size:12.8000001907349px"> }</span><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">but you have to keep pointer to memory, not to forget to deallocate it etc</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">regards</span></div><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">OK</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jul 31, 2015 at 10:18 AM, quadprob <span dir="ltr"><<a href="mailto:gustav.lundin@saabgroup.com" target="_blank">gustav.lundin@saabgroup.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
My program is suffering from very noticeable start up times even though<br>
rendering itself is quite smooth. From profiling I've learnt that what's<br>
taking up most of the time is the vtkCell constructor calls. So what I'm<br>
essentially looking for is to speed up something like this:<br>
<br>
public static void main(String []args) {<br>
int numElems = 739872;<br>
vtkCell[] elems = new vtkCell[numElems];<br>
<br>
long startTime = System.nanoTime();<br>
for(int i = 0; i < numElems; ++i) {<br>
elems[i] = new vtkHexahedron();<br>
}<br>
long stopTime = System.nanoTime();<br>
System.out.printf("Took %dms\n", (stopTime-startTime)/1000000);<br>
}<br>
<br>
Do I have any options other than parallelizing the main loop?<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="http://vtk.1045678.n5.nabble.com/Speed-up-cell-allocation-tp5733208.html" rel="noreferrer" target="_blank">http://vtk.1045678.n5.nabble.com/Speed-up-cell-allocation-tp5733208.html</a><br>
Sent from the VTK - Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a><br>
</blockquote></div><br></div>