[Closed] Collecting objects creates slow downs
fn getTrcMarkers=
(
currentTRCmarkersRef=for o in objects where (findItem currentObjects o)==0 collect (nodeTransformMonitor node:o forwardChangeMsgs:false)
gc()
currentTRCmarkersRef
)
The function above is running in Max 2008 in a scritped modifier. If sets an array called currentObjects=objects as array then it imports TRC markers from a file and sorts out which objects have been imported by running the above. I believe there is where I now have a massive slow down. I was doing this in Max 8 use just a #nodeTab but that was even slower in Max 2008 so I have changed to creating weak references and storing them in a maxObjectTab. This is a bit faster but still really slow.
What I mean by slow is that Max doesn’t perform after the the functions have been run. There is a registerTimCallback that allows the character to track the TRC markers in real time. OR at least in Max 8 it was real time. In 2008 I have to save and reload the file for the real time to happen. I’m trying to run a GC() and that doesn’t help at all. Any suggestions as to where or what might be causing a huge performance lose like this.
Please, something some one, this is killing me. Suggestions on things to look for…anything.
Do you know where the slowdown is happening?
If you collect (“ABC”) does take the same performance hit?
Well I’m not a 100% sure where it is but if I don’t do the collection it is fine, or if I save adn then relaod the file it is fine. I”m wondering if there is something that is getting clogged up caused by the import of the TRC file and then collecting all the nodes. Like the import isn’t complete and it is already trying to do the collection.
K it isn’t the collection of the object but storing them in the modifier that is killing it. Once again I just save the file and reopen it and it is fine. Problem for others testing it is you need to have the character and have the callBack running to see the slow down and I can’t share that.
Actualy I think that it is the importFile command that is causing the problem.
Another update on the test.
I have cmpletely eliminated the callBack and I’m just running a for loop from 1 to 100, setting the sliderTime and then just running the code that matches the rig to the markers and when doing it right after importing the markers it is increadibly slow. Save, reload and run the loop and it is fast.
Hmmm I don’t think I can be of any help. I’m not familiar with any of the components of the script.
My only ignorant suggestion would be to explore possible cacheing methods.
If calling it in real time isn’t feasible is there a way to preload the data into a standard Max datastructure and then work with that instead of hitting the import function multiple times?
Or is that what you’re trying to do with the collect?
The file isn’t being left open in memory is it? Is there some sort of .close() function that can be executed? Is it in a CSV format? Can it be read directly? Can you just dump the whole file into max memory and work with it there? Maybe it’s hitting the hard drive for each frame instead of the instance in memory.
Maybe it’s witches.
Thanks, import isn’t being called multiple times, just once to import the data.
Just as a follow up on the problem I was having. Looks like the TRC importer isn’t working well at all in Max 2008 and probably wasn’t all that good in previous versions.
Here are some of the issues with it.
First off in 2008 there is the slow down that I was talking about. This didn’t have this problem in Max 8 or 9. Another issue is that it imports the data laying face down and it has to be rotated up. With a test file that has 142 markers with 650 frames it takes about 10 seconds to import the data.
To correct the problem in my character system I wrote my own TRC importer by parsing the data from the file. My script takes about three seconds to read the same data into the file doesn’t produce any slow downs and doesn’t leave the markers face down. Interesting thing with the orientation is that I didn’t have to do anything to the data to create it the right way up. I can ony assume that the built in tool is swapping the Y and Z when it doesn’t need to. Maybe the TRC files that I’m working with have been written with Max in mind but if that is the case you would think there would be an option for swaping it on import.
So if you are doing lots of importing of TRC you might want to go the same root.