Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any tips for making the library run faster? #47

Open
eilat-inbal opened this issue Jul 9, 2024 · 2 comments
Open

any tips for making the library run faster? #47

eilat-inbal opened this issue Jul 9, 2024 · 2 comments

Comments

@eilat-inbal
Copy link

eilat-inbal commented Jul 9, 2024

Hi,
Thanks for this awesome library!
I'm getting great results but the computation time is very long...
Any tips on how to make it run faster?
I'm running on windows, c++ like this:

coacd::Params params;
params.preprocess_mode = "on";
params.prep_resolution = 150;
params.pca = false;
params.mcts_max_depth = 2;
params.mcts_iteration = 60;
params.merge = true;
params.threshold = 0.02;
coacd::Model convexMesh;
convexMesh.Load(vertices, indices);
convexParts = coacd::Compute(convexMesh, params);

for my mesh, with these parameters t took a few minutes!
I tried making the threshold bigger and the prep_resolution smaller. and that helps but the computation is still very long, and the results are not as good...
any further options for multithreading? for GPU?

image

thanks!
Inbal

@SarahWeiii
Copy link
Owner

Hi, the code supports using OpenMP for parallel computing, have you already enabled that?

@kermado
Copy link

kermado commented Sep 10, 2024

I was able to make the library quite a bit faster (at least 3X) by performing some simple optimizations. The main changes, IIRC, were:

  • Passing large objects by const reference, especially vectors.
  • Removing the use of std::pow() for computing small integral powers.
  • Reducing heap allocations by caching containers.
  • Using faster hash maps.

Also, since the library allocates quite a lot of memory, it may be worth using a different memory allocator if building with multithreading. I found Mimalloc to give good results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants