-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Switch CARBON_VLOG
to support a format string API.
#4283
Merged
Merged
Commits on Sep 8, 2024
-
Switch
CARBON_VLOG
to support a format string API.The goal is to replace our stream operator APIs with format string APIs that can be made to have much less impact on inlining and other optimizations of the performance critical path through the code. Several experiments show that the most compact representation we can arrange for is one that calls an uninlined function and passes a minimal number of arguments to it. It doesn't help to do any work to minimize the arguments such as building a lambda -- the cost of extra code to merge the arguments is likely to outweigh the benefit. Initial experiments showed that switching a hot but uninlined function to this new API enabled inlining and the subsequent performance improvement. This also adds a 'TemplateString` utility that allows using a string literal as a template parameter. This is useful to remove the format string itself from the arguments passed to the function by passing it as a template argument instead. Currently, support is left in place for both APIs because with `CARBON_VLOG` we can detect whether or not any message was provided expecting a format string. This should allow incrementally migrating code to this API. I've added some test coverage in this PR, but I'll separate out any switching of parts of the codebase over. The goal is to eventually replace all the usages and remove the streaming support entirely. This PR doesn't update `CARBON_CHECK` in the same way because it is substantially more complex to switch. I have a few experimental PRs looking at that and will discuss how best to approach this with the specific challenges check presents separately. But the goal is for all of the macro-based output APIs to move to format strings rather than streams.
Configuration menu - View commit details
-
Copy full SHA for 0056c69 - Browse repository at this point
Copy the full SHA 0056c69View commit details
Commits on Sep 9, 2024
-
Apply suggestions from code review
Co-authored-by: josh11b <15258583+josh11b@users.noreply.github.com>
Configuration menu - View commit details
-
Copy full SHA for 2ff364c - Browse repository at this point
Copy the full SHA 2ff364cView commit details -
Configuration menu - View commit details
-
Copy full SHA for aab411a - Browse repository at this point
Copy the full SHA aab411aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 59a13b8 - Browse repository at this point
Copy the full SHA 59a13b8View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6fd5168 - Browse repository at this point
Copy the full SHA 6fd5168View commit details
Commits on Sep 11, 2024
-
Apply suggestions from code review
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Configuration menu - View commit details
-
Copy full SHA for b552b26 - Browse repository at this point
Copy the full SHA b552b26View commit details -
Update common/template_string_test.cpp
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Configuration menu - View commit details
-
Copy full SHA for d04daec - Browse repository at this point
Copy the full SHA d04daecView commit details -
Configuration menu - View commit details
-
Copy full SHA for f93b3b2 - Browse repository at this point
Copy the full SHA f93b3b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for 91e1e8e - Browse repository at this point
Copy the full SHA 91e1e8eView commit details -
Configuration menu - View commit details
-
Copy full SHA for b79e8ba - Browse repository at this point
Copy the full SHA b79e8baView commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.