Oh, sorry, I never *actually* answered your question. Yes, if I run your code, I get similar timing results. The naive numpy copy definitely does its looping and unpacking in python. But that's my point. I'm proposing a way that would allow us to copy that data without python iteration to any type that lets us map it in ctypes. This is without having to write library specific code in c++.
I did a little more work, and made a gist of a pure python imathnumpy.arrayToNumpy. It runs at native speeds, and handles almost all imath array data types (I skipped string arrays), not just the 3 that are built in to the c++ module. https://gist.github.com/tbttfox/0fc8dbe284f8dcd143cb507658a6fd8d Also, here's a use-case that doesn't use numpy: Maya python api array types allow access via MScriptUtil as SWIG pointers. And those pointers allow accessing the pointer address. So we can use the exact same ctypes technique to map the imath objects to openmaya objects. With that running locally, I've got an alembic exporter for Maya written in python that runs at a speed comparable to the c++ one. ~T.Fox
_______________________________________________ Openexr-devel mailing list Openexr-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/openexr-devel