-
Notifications
You must be signed in to change notification settings - Fork 95
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
Speed up Array extensions #507
Speed up Array extensions #507
Conversation
src/FSharpPlus/Extensions/Array.fs
Outdated
| null -> null | ||
| [||] -> [||] | ||
| _ -> | ||
let candidate = new ResizeArray<'T>() |
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.
Try ArrayCollector
instead, I think it's faster.
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.
Excellent !
Looks good to me, just a few details.
src/FSharpPlus/Extensions/Array.fs
Outdated
match source with | ||
| null -> null | ||
| [||] -> [||] | ||
| _ -> |
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.
Maybe we should remove null handling for the moment until we agree on a general strategy.
src/FSharpPlus/Extensions/Array.fs
Outdated
oldValueIndexRight <- oldValueIndexRight - 1 | ||
|
||
if matchingElements then | ||
candidate.AddRange(newValue) |
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.
Parens around newValue
might not be needed.
Same below.
src/FSharpPlus/Extensions/Array.fs
Outdated
&& source.[sourceIndex + oldValueIndexRight] = oldValue.[oldValueIndexRight] | ||
|
||
while oldValueIndexLeft <= middleIndex | ||
&& oldValueIndexRight >= middleIndex |
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.
Let's use 4 spaces indent, so add 2 spaces here
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, thanks !
No description provided.