-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
performance: remove unneeded ToArray calls
#2174
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
base: main
Are you sure you want to change the base?
Conversation
0100f84 to
3ddf8e4
Compare
mgravell
left a comment
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.
Looks good; I'll need to double check impact on the full TFM range (i.e. the older overloads), but: 👍
|
|
||
| // Before we get all emitty... | ||
| var lookup = string.Join("|", names.ToArray()); | ||
| var lookup = string.Join("|", names); |
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.
A "char" vs "string" can be used in Join() call.
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.
I'm scared of getting nerd sniped here, but I'm pretty sure they do the same thing. string.Join(char and string.Join(string. both call JoinCore. The only difference is it converts the char into a Span via new ReadOnlySpan<char>(in separator) before calling JoinCore. Code here
I would love to know if the generated code is different between char and string
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.
You are right, they are similar. I was thinking of semantic use of "char" with the explicit visibility purpose of a-single-char-operation :)
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.
@mgravell With lots of pull requests in the queue, are we going to have a new Dapper release any time soon? And, if you or your team needs assistance, how can it be possible?
Removes unnecessary
ToArraycalls