Python multiprocessing/threading or any other ways of acceleration?

Hello,

I’m currently trying to detect connected vertices (edge loops) for hair related script that while processing 50-100 000 vertices may hang cpu for 10 seconds (multiple recursive scripts). I noticed I cannot apply multiprocessing/threading as new instances of blender are opened instead. I might be doing it wrong or it may be down to Blender. As such I am interested in hearing your opinion on what are good tricks to accelerate such processing (keywords: for loops, recursion, parallel, 100% cpu utilization ;)).

Thank you!

Threading won’t help, you need to use multiprocessing. Multiple processes can run on a virtual core each, utilizing the maximum cpu power if there are at least as many processes as virtual cores in the system. There is an overhead for communication though, and each process will claim its own memory.

http://www.blender.org/api/blender_python_api_2_73_release/info_gotcha.html#strange-errors-using-threading-module

Just the thing needed. Thank you CoDEmanX!