Using the reference python implementation to write collections of meshes seemed much slower that using other formats such as dumping the binary data using the numpy savez routine.
After profiling the OMFWriter call it was determined that approximately 90% of the time was taken up in validation of the elements and only 10% in writing the file. Further investigation determined that most of this time is spent in the _validate_mesh method of omf.surface.SurfaceElements and the validate method of the property array classes in properties.math.
For the _validate_mesh case, it does the numpy min/max on the omf.data.Int3Array rather than the underlying numpy array which is about 1000 times slower than it needs to be.
The Vector3Array validate routine will always iterate through the array to check for direction strings even though the typical value that is being checked is a numpy array of floating point numbers.
Using the reference python implementation to write collections of meshes seemed much slower that using other formats such as dumping the binary data using the numpy savez routine.
After profiling the OMFWriter call it was determined that approximately 90% of the time was taken up in validation of the elements and only 10% in writing the file. Further investigation determined that most of this time is spent in the _validate_mesh method of omf.surface.SurfaceElements and the validate method of the property array classes in properties.math.
For the _validate_mesh case, it does the numpy min/max on the omf.data.Int3Array rather than the underlying numpy array which is about 1000 times slower than it needs to be. The Vector3Array validate routine will always iterate through the array to check for direction strings even though the typical value that is being checked is a numpy array of floating point numbers.
Examples and profiles can be provided on request.