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

Change _topods_entities #873

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft

Conversation

jdegenstein
Copy link
Collaborator

Preliminary testing show the new version has slightly better performance. According to several sources the returned order when using TopTools_IndexedMapOfShape and TopExp.MapShapes_s is perfectly repeatable -- unlike the existing version. I believe the one test that was failing is a result of the topology being explored in a different order, which according to what I have read, can affect the forward/reverse properties of TopoDS shapes.

I still would like a MacOS arm64 user to test this and confirm performance is not significantly worse (the macos github runners have extremely variable performance). Opening as a draft PR for now as a result of this uncertainty.

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.57%. Comparing base (1b5688a) to head (55ad15a).
Report is 9 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #873      +/-   ##
==========================================
+ Coverage   96.38%   96.57%   +0.19%     
==========================================
  Files          31       31              
  Lines        9120     9120              
==========================================
+ Hits         8790     8808      +18     
+ Misses        330      312      -18     

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

@jdegenstein
Copy link
Collaborator Author

Received from benchmarks for macos arm64 and this is probably slightly faster than the older algorithm -- but more importantly it is definitely not significantly slower on all platforms This is ready for review.

@jdegenstein jdegenstein marked this pull request as ready for review January 16, 2025 19:50
@jdegenstein jdegenstein requested a review from gumyr January 16, 2025 19:50
Copy link
Owner

@gumyr gumyr left a comment

Choose a reason for hiding this comment

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

TopExp_Explorer is directly used in quite a few modules, should they all be changed over to this method?

During the refactor I followed the number of function calls in edges - here is what I found:
1- Mixin1D.edges(self) calls Shape.get_shape_list(self, "Edge")
2- Shape.get_shape_list(self, "Edge") calls shape.entities(entity_type)]
3- shape.entities(entity_type)] calls _topods_entities(self.wrapped, topo_type)
4- _topods_entities(self.wrapped, topo_type) calls TopExp_Explorer
5- TopExp_Explorer causes a dict lookup from str to a TopAbs ENUM (e.g. ta.TopAbs_VERTEX) which could have been given to at the start.

Maybe we should look at optimizing selector methods given how frequently they are used?

@jdegenstein
Copy link
Collaborator Author

Yes, there is a lot of room to reduce the layers of function calls here and optimize the various type conversions that occur. Should I merge this and we can proceed with that separately?

@gumyr
Copy link
Owner

gumyr commented Jan 17, 2025

What about the other uses of TopExp_Explorer - should they be eliminated as well?

@jdegenstein jdegenstein marked this pull request as draft January 20, 2025 04:29
@jdegenstein
Copy link
Collaborator Author

FYI I have been working on this, refactored most of the places directly using TopExp_Explorer to instead use _topods_entities. I am still looking at optimizing the overall flow of function calls as you described.

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