Maya not responding

Hi guys

Since i have to write l-system script for maya i have small problems but now i have one huge and i can't work because Maya is not responding and shutting down after script ends (i think that there is problem with script running time because there are 6000 or more iteration).

Same problem exist in maya 2012 and 2011 x64 on windows 7 64-bit

script is in pymel

Two thoughts:

Does it have to run inside of Maya?  You could run it in a sub-process callout, so Maya's doesn't lock up, and have it spit back all the commands (when it's done) to run inside of Maya.

#2) Is it something you have to write, or would paintFX do the trick?

hth. 

i have to write it because it's my graduation project;)

What do you mean when you are thinking about sub=process? how i can do that?

Thx for advice about subprocess , but can you tell me how can import scene generated with subprocess to my actual maya scene?

Btw one thing. if you are writing a procces intensive script: DO NOT USE PYMEL.
Pymel is great for its syntax and way of coding. but its extremely slow. try rewriting it in maya python or use mrv if you want an easy to use syntax.(or maybe just rewrite the procces intensive stuff in maya python)
mrv however is not precompiled with the maya package so you will have to install it manually.

i know about mrv and i think i will use so can you give me some internet adresses about mrv?

http://packages.python.org/MRV/install.html
here is the explanation on how to install it. other than having testing it once i do not know much about it. Only that its fast ^^
here is a comparrisson
http://packages.python.org/MRV/compare/performance.html

It doesnet really help to try to change any framework. Because we simply do not know whats actually using up all time. One thing is for sure all creation of maya objects must happen more or less in the main therad. And it is most likely, tough without profinig impossible to know for sure, that the most time consumed is by maya allocation of objects. A naive approach on maya programming with lot of data has a tendency to do this.

Switching over to faster interpretted python does not help in this kind of case because the bulk of the problem is caused by pure C++ objects. It is only if your computation really needs better bindings. Such as is the case when your doing nodes withe maya python api etc. In any case moving over to mrv is not a solution if you intend others to use your script.

Now then few comments taht might help you gauge the problem.

Switch undo OFF, or atleast never update the global selection list.
Allways compute the unique name of created object yoruself and assign it too.
Restrict your node history building, 10000 create nodes with 30000 subnodes IS a bit unwieldy even on a good maya day.
Dont make tens of thousands of individual objects!

other things:

Asympttotic complexity. If your asymptotic complexity is O(n^2) your till screwed even if you can get the same code to run 100 faster it will still be too slow for any particular purpose. Especially since your iteration range is in 6000 or more. Work on your algorithm it has a much higher payof rate than any optimisation gives you.

i have to write it because it's my graduation project;)

No you dont have to do this approach you just need to do something that results in something liek this. Theres many perfectly good alternative solutions to this. Such as writing the data directly out as a mi file and then using some very simple proxy geometry inside maya. Etc etc.

Theres no magick in making a O(n^3) algorithm that will kill even the fastest supercomputer. Belive me i have done that, rather the trick is to get the acceptable end result with acceptable losses. Now this is MUCH harder.

PS: theres realy nothing that says what your doing actually can be easily done if at all! You may actually need to go making your own instancer in worst case scenario

you know this is not about speed at all, i can wait for results but maya is crashing all the time;)

Speed and crash are interlinked. Speed is slow because of memory use memory use is causing crash.

Joojaa you are great:) because of you i was thinking about my script and i think that i can use locator instead of transform node it will be huge difference. 100000 locators in loop are created without any problems so there will be 700 shape nodes instead of 700 shapenodes and 2000 transform nodes:) you are great. i hope my tree generator will be almost as good as your advices:)