http://www.huyng.com/posts/python-performance-analysis/

The line profiler would make this a lot easier for you to profile. Just
decorate the desired function with @profile
No imports needed.
Then run it with kernprof.py and the desired flags.

For simple calls into the Maya commands, it would be hard to know what the
implementation is doing. It very well could be loading a larger data
structure the first time, and then hitting a cache for subsequent calls.

On Thu, 5 Nov 2015 3:47 AM  <[email protected]> wrote:

> Hi,
>
> im trying to make my script as efficient as possible. I have placed all
> these lines in my code to see how fast different sections are running and
> then just focusing on those areas.
>
> ###########################
> t0 = time.clock()
>
> print time.clock() - t0
> ###########################
>
> The problem is certain areas seem to take a long time when they have no
> need to.
>
> there is a loop in my script that just finds four points in space:
>
> pnt1=cmds.pointPosition('curve5.ep[2]')
>              pnt2=cmds.pointPosition('curve5.ep[4]')
>                          pnt3=cmds.pointPosition('curve5.ep[5]')
>                      pnt4=cmds.pointPosition('curve5.ep[6]')
>
> but the very first time the first line is called, the program takes 0.5
> seconds to complete, but then every time it loops through again it takes
> 0.0001 seconds to complete. Can anyone explain why this might be. really
> confusing. I presume it maybe loading curve into memory or something? dunno
>
> thanks,
> Sam
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/e7373880-cf36-4835-ad81-ca5d9d6e31fb%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0M8d7fSkL%3D311u0Xc1hMzUqesb0dxKb8r7gt2t0D%3DqEg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to