Importing .brep files - slower in my application than in Salome or FreeCAD

Hi guys,

I have a small performance problem with reading .brep files in my application.

Basically, what I observe is that both Salome and FreeCAD import my .brep files way faster than my own application built using Openacascade 6.7.1 - it takes less than 10 seconds for them while even for my simplest test application which only loads this .brep file - it takes 28 seconds. I looked at the Salome code and it seems that I use the same approach - i.e. BRepTools::read(). Additionally, Salome manages to also mesh the surface for visualization in those 10 seconds, which I don't do.

Any ideas on why this might happen? Perhaps there are some flags for building Opencascade that I am missing? I have tried building with TBB, but setting MMGT_ options to various values don't seem to change the performance of this operation.

The platform is MSVS 2013, Win 7 x64.

Thank you for any ideas,
Rostislav.

PS: this is kind of a cross-post from Salome forum. I hope that this is ok.

The test app code is as simple as:

#include
#include
#include

#include
#include

void main()
{
auto start = std::chrono::high_resolution_clock::now();
TopoDS_Shape s;
BRep_Builder b;
BRepTools::Read(s, "big_model.brep", b);
std::cout (std::chrono::high_resolution_clock::now() - start).count() }

Forum supervisor's picture

Dear Rostislav,
There is known issue with low performance of C++ streams in MSVS 2012 (likely inherited by 2013), severely affecting performance of BRepTools::Read() in OCCT 6.7.1. If Salome and FreeCAD are built by previous versions of MSVC, they are not affected and thus work faster. This problem has been fixed recently (issue id 25252, not available publicly) and it should be OK in OCCT 6.8.0.beta. Please test it with current master or 6.8.0; we will appreciate if you share your results.

Best regards
FSR

Rostislav Khlebnikov's picture

Hi FSR,

I would definitely like to try this out. However, I usually use cmake to build opencascade. However, current master doesn't seem to be ready for a cmake build - the main CMakeLists.txt searches for files in adm/cmake/, but this folder does not exist. Could you give me any pointers regarding this?

Rostislav.

Forum supervisor's picture

Dear Rostislav,
I suggest you to use source archive of 6.8.0.beta; the link can be found on page http://dev.opencascade.org/index.php?q=node/1003.
Best regards
FSR

Rostislav Khlebnikov's picture

It still complains on the missing files:
adm/cmake/occt_modules.cmake
and
adm/cmake/occt_toolkits.cmake

Just for the test, I integrated the changes from the relevant commit to my Opencascade 6.7.1 source tree and the results are really nice - it is 3.2 seconds instead of 25 (still, my ubuntu version with gcc 4.9 performs at 1.3s for this model, but it's great that you created a workaround for this std library problem in VS2012/13).

I assume that all the CMake problems will be fixed by the actual release of 6.8.0 - really looking forward to it!

Rostislav.