Skip to content

Nef_3: Proof of concept for no-hashmap approach.#6415

Closed
GilesBathgate wants to merge 4 commits intoCGAL:mainfrom
GilesBathgate:Nef_3-performance_no_hashmaps-GilesBathgate
Closed

Nef_3: Proof of concept for no-hashmap approach.#6415
GilesBathgate wants to merge 4 commits intoCGAL:mainfrom
GilesBathgate:Nef_3-performance_no_hashmaps-GilesBathgate

Conversation

@GilesBathgate
Copy link
Copy Markdown
Contributor

@GilesBathgate GilesBathgate commented Mar 15, 2022

Summary of Changes

In Nef_3 hashmaps are used to associate information with objects at runtime, for example, to flag that a HalfEdge has been visited there might be a Unique_hash_map<Halfedge_handle,bool> visited;. If the class HalfEdge had a member variable called visited this could be used instead to indicate whether the edge had been visited (although it would have to be reset afterwards) However this would mean adding lots of extraneous data to the classes depending on the method or algorithm that is processing the list of objects.

There is a generalised info container on all the classes which could be used. However, a mechanism is needed to make sure that the existing info isn't overwritten, and is restored to whatever it was before the processing was done.

Release Management

  • Affected package(s): Nef_3
  • Issue(s) solved (if any): draft/discussion only
  • License and copyright ownership: Returned to CGAL authors.

@GilesBathgate
Copy link
Copy Markdown
Contributor Author

GilesBathgate commented Mar 15, 2022

What I don't like about the PoC is it has to wrap the original info in a value type, and copying that value type is expensive. It also has to any_cast just to check whether the flag is set. So I came up with a possible alternative that could work, but needs to slightly alter the API:

https://gist.github.com/GilesBathgate/8ac8e314df53ec844e385ebd56ff071d

@GilesBathgate GilesBathgate force-pushed the Nef_3-performance_no_hashmaps-GilesBathgate branch from e88b896 to 6964486 Compare January 27, 2023 20:02
@sloriot sloriot changed the base branch from master to main September 16, 2025 19:22
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.

1 participant