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

[Impeller] use string view for labels in more places to defer allocatons. #49905

Merged
merged 3 commits into from
Jan 20, 2024

Conversation

jonahwilliams
Copy link
Member

This improves the performance of command encoding when there is no debugger attached. most labels are const char*, and so by accepting a string_view we can avoid actually creating a string if validations are disabled.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@@ -222,12 +223,13 @@ fml::StatusOr<vk::DescriptorSet> CommandEncoderVK::AllocateDescriptorSets(
context);
}

void CommandEncoderVK::PushDebugGroup(const char* label) const {
void CommandEncoderVK::PushDebugGroup(std::string_view label) const {
if (!HasValidationLayers()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is basically the improvement, since the labels are invisible if there are no validation errors, moving the allocation below means most of the time (benchmarks) they wont even be allocated.

vk::DebugUtilsLabelEXT label_info;
label_info.pLabelName = label;
label_info.pLabelName = label_copy.c_str();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to just use the label directly.

label_info.pLabelName = label.data();

Having an extra copy on the stack isn't really helping.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh duh, thanks!

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@matanlurey
Copy link
Contributor

test-exempt: non-semantic refactor (reduces string allocation).

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 20, 2024
@auto-submit auto-submit bot merged commit 53a2436 into flutter:main Jan 20, 2024
28 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 20, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Jan 20, 2024
…141916)

flutter/engine@a9b87c6...53a2436

2024-01-20 jonahwilliams@google.com [Impeller] use string view for labels in more places to defer allocatons. (flutter/engine#49905)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC jonahwilliams@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants