-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 App::about accept Cow #2504
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before agreeing to merge this, was there any performance issues?
This pull request is not meant to be merged. The example changes make no sense to be in the tree and are just there to show what was not possible beforehand. This is only one API adjusted, I suppose others remain with similar problems. It's meant to show the ergonomics of the API, as you asked for.
I don't know. I haven't done an analysis. But then, it's a cold method being adjusted, right? |
The ergonomics are definitely more complicated now. But the API is more useful now. I was wondering what the performance would say.
This line is not cold and is part of the parsing logic. |
What's the performance measurement setup you folks use? |
We use criterion, and we have benches setup already. You don't need to test the dynamic string. Just provide a static string to |
Seems as if there were a couple of regressions detected:
|
Some of it might just be margin of error. |
} else { | ||
self.parser.app.about | ||
self.parser.app.about.as_ref().map(|a| a.as_ref()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick suggestion: This could be written simpler:
self.parser.app.about.as_ref().map(|a| a.as_ref()) | |
self.parser.app.about.as_deref() |
(applies to other occurences of .as_ref().map(|a| a.as_ref())
as well, they can all be .as_deref()
)
Closing this. Thanks for the work @d-e-s-o. |
Draft only. See #2150