-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Change single char str patterns to chars #52646
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
I wouldn't be so sure, see #41993 |
Oh, ok; in that case I guess this might call for an update in clippy, as its cc @oli-obk |
@petrochenkov I just did a comparison using godbolt and the |
I don't see any benchmarks? :) |
@killercup see the related clippy lint. |
@petrochenkov #41993 only concerns about |
@ljedrz a piece of documentation is still no benchmark :) Seriously, if we don't have one, we should totally write one and add it. This is easily decidable once we have the facts. Edit: Maybe we can use the ones @kennytm wrote last year: Edit 2: We are currently linking to |
Since I just happened to have benchmarks from rust-lang/rfcs#2500, here's the relevant parts comparing .starts_with()
Speed ups:
.split()
Speed ups:
While |
📌 Commit 49c8ba9 has been approved by |
Change single char str patterns to chars A `char` is faster.
☀️ Test successful - status-appveyor, status-travis |
A
char
is faster.