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

Consider using find_or_emplace #304

Closed
domfournier opened this issue Jan 30, 2023 · 2 comments
Closed

Consider using find_or_emplace #304

domfournier opened this issue Jan 30, 2023 · 2 comments

Comments

@domfournier
Copy link
Contributor

key = key_func(x, y, z);

From K Davis.
There should be a faster method to directly add faces without touching the vector 3 times.

@jcapriot
Copy link
Member

The method is try_emplace that conditionally inserts elements into maps in C++, and is available in the C++17 standard, and it would easily improve the mesh creation time, as currently every time a new item (node, face, edge) is added to the map, it requires 2 searches (not 3).

This does mean we would be forced to use compilers which support this standard, which all of the recent ones do now so that shouldn't be too much of an issue. The only minor headache is that the compiler argument passed to msvcc is \std:c++17 and the argument passed to gnu/clang compilers is -std=c++17.

@jcapriot
Copy link
Member

Added in #308

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

2 participants