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

Make util::constexpr_ consteval #1658

Merged
merged 1 commit into from
Jul 8, 2024
Merged

Conversation

heinezen
Copy link
Member

@heinezen heinezen commented Jul 7, 2024

util::constexpr_ contains helper functions for the openage logger that should be evaluated at compile-time. However, at least for me, these functions were still evaluated at runtime instead. This created a lot of unnecessary call to these functions, especially strip_prefix, when logging messages. The log messages take up a giant amount of resources in the event loop for example, due to the frequent calls to the logger.

Since C++20 can enforce compile-time evaluation with the consteval keyword, so I replaced all constexpr specifiers in the namespace with that. I also changed the name of the namespace to util::consteval_ to make this change more clear.

@heinezen heinezen added improvement Enhancement of an existing component lang: c++ Done in C++ code labels Jul 7, 2024
@TheJJ TheJJ merged commit 1ab1d28 into SFTtech:master Jul 8, 2024
13 checks passed
@heinezen heinezen deleted the fix/consteval branch October 12, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Enhancement of an existing component lang: c++ Done in C++ code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants