Skip to content
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

Merged
merged 6 commits into from
Oct 3, 2022

Conversation

fcallejon
Copy link
Member

No description provided.

| null -> null
| [||] -> [||]
| _ ->
let candidate = new ResizeArray<'T>()
Copy link
Member

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.

Copy link
Member

@gusty gusty left a 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.

Comment on lines 57 to 60
match source with
| null -> null
| [||] -> [||]
| _ ->
Copy link
Member

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.

oldValueIndexRight <- oldValueIndexRight - 1

if matchingElements then
candidate.AddRange(newValue)
Copy link
Member

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.

&& source.[sourceIndex + oldValueIndexRight] = oldValue.[oldValueIndexRight]

while oldValueIndexLeft <= middleIndex
&& oldValueIndexRight >= middleIndex
Copy link
Member

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

@fcallejon fcallejon marked this pull request as ready for review October 3, 2022 20:24
@fcallejon fcallejon requested a review from gusty October 3, 2022 20:28
Copy link
Member

@gusty gusty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks !

@gusty gusty changed the title Update Arrays Speed up Array extensions Oct 3, 2022
@gusty gusty merged commit c56866c into fsprojects:master Oct 3, 2022
@fcallejon fcallejon deleted the fcallejon/arrays_update_replace branch October 4, 2022 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants