-
Notifications
You must be signed in to change notification settings - Fork 789
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
MakeCalledArgs allocates a struct tuple #9223
MakeCalledArgs allocates a struct tuple #9223
Conversation
oopsie doopsie daisy, this won't won't do |
Can't we just use X and Y separately? Then you also don't need to snd on it. |
@@ -564,3 +564,4 @@ type MaybeLazy<'T> = | |||
| Strict x -> x | |||
| Lazy x -> x.Force() | |||
|
|||
let inline vsnd ((_, y): struct('T * 'T)) = y |
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.
why the ('T*'T)
here and not ('a*'b)
?
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.
Agreed, this should be ('a * 'b)
or ('T * 'U)
.
mhm just looked at it a bit deeper. Position is used in a SortBy and therefore we would probably have to tuple again anway |
Yep, this is probably the most minimal/straightforward change if we're interested in knocking down the (small) amount of needless allocations |
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 fine, just minor comment.
@@ -821,7 +821,7 @@ let OutputPhasedErrorR (os: StringBuilder) (err: PhasedDiagnostic) (canSuggestNa | |||
let nameOrOneBasedIndexMessage = | |||
x.calledArg.NameOpt | |||
|> Option.map (fun n -> FSComp.SR.csOverloadCandidateNamedArgumentTypeMismatch n.idText) | |||
|> Option.defaultValue (FSComp.SR.csOverloadCandidateIndexedArgumentTypeMismatch ((snd x.calledArg.Position) + 1)) | |||
|> Option.defaultValue (FSComp.SR.csOverloadCandidateIndexedArgumentTypeMismatch ((Lib.vsnd x.calledArg.Position) + 1)) //snd |
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.
Should we always be qualified with Lib
? Is that how other functions from Lib
are called elsewhere?
* MakeCalledArgs allocates a struct tuple * Add vsnd
In a trace from here: https://developercommunity.visualstudio.com/content/problem/1035124/trace-of-editing-experience-with-in-memory-cross-p-1.html
I found what looked like needless allocations of a tuple of two integers:
This seemed like a needless tupling of two ints, though the values are contained within a larger record that's going on the heap anyways. But in my own testing struct tuples, when it's just things like two ints, is almost always faster for the CPU anyways