Skip to content

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
@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