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

Collider optimization #978

Merged
merged 13 commits into from
Oct 9, 2024
Merged

Collider optimization #978

merged 13 commits into from
Oct 9, 2024

Conversation

pca006132
Copy link
Collaborator

Unrelated:

  1. Fixed tracy (again the cmake interface vs public issue)
  2. Moved some APIs from Vec to VecView.

Optimizations:

  1. Only do collision check once, use thread local buffers to store the result and merge in parallel when everything is completed. Note that this requires making the vector copy sequential, so I added some flags to help.
  2. Allow reusing collider result buffer, reduce reallocation during complex polygon triangulation.
  3. Some low level optimization.

This results in about 8% time reduction for perfTest (2.5s to 2.3s), and 10% time reduction for running triangulation tests (~1900ms to ~1700ms)

@pca006132 pca006132 requested a review from elalish October 5, 2024 06:09
Copy link

codecov bot commented Oct 5, 2024

Codecov Report

Attention: Patch coverage is 81.08108% with 14 lines in your changes missing coverage. Please review.

Project coverage is 88.12%. Comparing base (d437097) to head (7ccf97f).
Report is 117 commits behind head on master.

Files with missing lines Patch % Lines
src/sparse.h 15.38% 11 Missing ⚠️
include/manifold/vec_view.h 93.33% 1 Missing ⚠️
src/collider.h 92.30% 1 Missing ⚠️
src/vec.h 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #978      +/-   ##
==========================================
- Coverage   91.84%   88.12%   -3.72%     
==========================================
  Files          37       62      +25     
  Lines        4976     8675    +3699     
  Branches        0     1041    +1041     
==========================================
+ Hits         4570     7645    +3075     
- Misses        406     1030     +624     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

src/polygon.cpp Outdated Show resolved Hide resolved
Copy link
Owner

@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks great!

src/polygon.cpp Outdated Show resolved Hide resolved
src/vec.h Outdated Show resolved Hide resolved
Copy link
Owner

@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks! Any idea what's wrong with the Black formatter?

@pca006132
Copy link
Collaborator Author

Hmmm no idea, it seems that everything somehow went wrong. We can try to run the CI again...

@pca006132
Copy link
Collaborator Author

The weird thing is that it starts to fail after the last commit, but the last commit should not affect anything...

@pca006132
Copy link
Collaborator Author

I will investigate this later this week.

@pca006132
Copy link
Collaborator Author

Just got some time, I still don't understand why the previous test failure can happen, but I guess it is caused by the cmake changes in the master branch. The weird thing is that I haven't merged the changes at f632177. Anyway, the tests pass now.

For the black formatter error, I think this is caused by the latest version (released a day ago) no longer supports python 3.8, and Ubuntu 20.04 ship with python 3.8 by default. Should be fixed by installing python 3.12. (which I did previously for the cmake formatter because I forgot Ubuntu ships with python preinstalled...)

Copy link
Owner

@elalish elalish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@elalish elalish merged commit 451829f into elalish:master Oct 9, 2024
21 checks passed
RahimovIR pushed a commit to RahimovIR/manifold that referenced this pull request Oct 18, 2024
* vec changes

* collider optimization

* fix tracy

* slight optimization for polygon

* cleanup

* cleanup

* CMAKE_CXX_FLAGS should also be a string

* slightly optimize polygon

* should be lowest instead of min

* address comments

* update MANIFOLD_PAR guard

* try to fix black CI
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

Successfully merging this pull request may close these issues.

2 participants