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