> Yes, possibly it's because it retrieves the MObjects and MDagPaths  
> from the strings that cmds.ls() actually returns. Then it will have  
> to query it's database to attach the respective function sets to the  
> object ( and possibly more ).
> This makes each API wrapped object quite an expensive little fella ;).

yes, we do as little as possible to instantiate an object, but this  
still means converting the string to an MObject/MDagPath or MPlug and  
determining the node type.  once an object is instantiated, you'll see  
performance benefits in certain areas, like calling methods that are  
derived from the API, because there is no longer any need to convert  
from MObject/MDagPath/MPlug back to a string.  also, big on the road  
map for the next version is rewriting ls and listRelatives using the  
API:  this will allow us to implement advanced performance features  
like iterators while also avoiding the unnecessary and time-consuming  
conversions that are required when communicating between API and  
maya.cmds.   Lastly, we'll be working with Autodesk to improve this  
bridge between API and maya.cmds.

-chad




>
> Once more this shows that you either get speed at the expense of  
> convenience for the programmer or you sacrifice it.
>
> On Mon, Mar 16, 2009 at 10:57 AM, Drake <[email protected]> wrote:
>
> In order to figure out the boost of performance migrating from 0.7 to
> 0.9,
> I did a quick test by following code snippets:
>
> -------------------------------------
> from pymel import *
> import time
> a = time.time()
> allNodes = ls()
> b = time.time()
> print b-a, len(allNodes)
> -------------------------------------
>
> And it turns out:
> -------------------------------------
> 0.9RC5: 14.110008955 49798
> 0.7.9:  0.54513502121 49798
> -------------------------------------
>
> Environment: Maya 8.5 sp1 x64 in Linux (Ubuntu 8.04)
> ---------------------------------------------
>
> I guess the overload comes from initialization of classes but not sure
> yet.
>
> - Drake
>
> On Mar 13, 3:36 pm, Chadrik <[email protected]> wrote:
> > RC5 is posted.  this should be the last one.  8.5 should be fairly
> > well supported now, except for the API undo.
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to