Personal tools
You are here: Home Forum Use Re: How to accelerate this python file ?

Re: How to accelerate this python file ?

Up to Use

Re: How to accelerate this python file ?

Posted by pascal KREZEL at October 23. 2012

Hi,

The python file joined to this text needs 6 secondes to be executed on my computer in SalomeMeca 12.2.
Can it be accelerated ?
You will get the time used at the end in the Python window.

Sincerely.

Pascal KREZEL

Attachments

Re: How to accelerate this python file ?

Posted by Saint Michael at October 23. 2012

Without a deep long-time analysis, I'd say NO.

St.Michael

Re: How to accelerate this python file ?

Posted by Christophe Bourcier at October 23. 2012

Hi,

You can use python profiler to see which functions take too much time: http://docs.python.org/library/profile.html

See the (non-attached due to size limit) graph generated with gprof2dot: ftp://ftp.cea.fr//incoming/y2k01/salome-forum/systeme_complexe_1.pstats.png

As you can see, the visualisations of the shapes in GEOM takes 38% + 27% of the total time. You should comment them if speed is preferred over visualisation.

You can organize your script in functions to better see which steps take too much time.

Christophe

Re: How to accelerate this python file ?

Posted by pascal KREZEL at October 23. 2012

Thank you for your answer.

In fact, if I avoid the visualisation during the creation of the model, the time is the same  when the visualisation is done at the end.

And if I simplify the modelisation of the pipe, it is the same.

So, it is the visualisation of the shapes that takes most of the time, even if these ones are simple.

 

Pascal

 

Previously Christophe Bourcier wrote:

Hi,

You can use python profiler to see which functions take too much time: http://docs.python.org/library/profile.html

See the (non-attached due to size limit) graph generated with gprof2dot: ftp://ftp.cea.fr//incoming/y2k01/salome-forum/systeme_complexe_1.pstats.png

As you can see, the visualisations of the shapes in GEOM takes 38% + 27% of the total time. You should comment them if speed is preferred over visualisation.

You can organize your script in functions to better see which steps take too much time.

Christophe

 


 

Powered by Ploneboard
Document Actions