Applying matrices through API

I am writing a pose tool using matrices and I have all of the bits working, however I am running into issues when I put it all together. I have gotten as far as being able to manipulate the matrices and reapplying them to each object using xform( obj, m=newMatrix, ws=True ), however I think order of application is an important step I am missing. I could work out the order in which to apply based on hierarchy but I’m concerned about that being slow. Is there away to apply all the matrices to all of the objects at the same time, or maybe a free way to get the hierarchy order without splitting long names of objects?

Thanks in advance.

There’s no way to apply them all at the same time. Doing a simple hierarchy parse isn’t that time consuming though.
Also, if you store and apply your matrix in parent space than the problem goes away.