I was told that Python API is faster than Mel
well no its not that, it works on faster methods but theres a lot of caveat at faster. Mel is actually faster than the C++ api in quite a bit of cases. The python scripting api (maya.cmds) IS MEL, just written in python, since theres some overhead running python its slower if you do the exact same thing.
The maya API on the otherhand is somewhat faster since ist more atomic. Theese things just dont traslate into same terms because they have different purposes tough. Theres not much point in translating one thing form one system to another IF you keep everything the same, its the algorithmic things, and in case of the C++ the compilers optimizer, that makes stuff faster. However changing things like this gets you just so far, better algorithms are the key for faster operation.
I was hoping the intersect function might speed things up but was unable to get it to work.
Err it dont exactly work that way. But yeah sure.
The typical slowdowns is doing the wrong thing with wrong module, so looping over a setAttr costruct is slow mainly because it builds up undo items, and theres a lot of validation going on. This si especially true if your calling mel in expressions, in which case its sure as hell is faster. But theangain calling pthon is expressions is just that very slow because your wrapping the wrong thing and doinga compile at every turn. That is unless your python was wrapped to be visible in mel as a mel commend (in which case theres just a little overhead)
Likewise here, if you intersect many things in one go its faster than if you intersect it many times separately. Becase maya caches the results in between. Offourse mel has no real choce on the matter for it its allways a separate operation.