Skip to content

Commit

Permalink
Performance improvement for filtered collection (#441)
Browse files Browse the repository at this point in the history
* Remove LINQ

* increment version number
  • Loading branch information
runceel authored Sep 23, 2023
1 parent 9d4f78a commit 9424c75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Source/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<RootNamespace>Reactive.Bindings</RootNamespace>
<Version>9.3.1</Version>
<Version>9.3.2</Version>
<Authors>neuecc xin9le okazuki</Authors>
<PackageProjectUrl>https://github.com/runceel/ReactiveProperty</PackageProjectUrl>
<PackageTags>rx mvvm async rx-main reactive</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,16 @@ public void Dispose()
CollectionChanged -= Source_CollectionChanged;
}

private int FindNearIndex(int position) => IndexList.Take(position).Reverse().FirstOrDefault(x => x != null) ?? -1;
private int FindNearIndex(int position)
{
for (int i = position; i >= 0; i--)
{
var value = IndexList[i];
if (value != null) return value.Value;
}

return -1;
}

private void AppearNewItem(int index)
{
Expand Down

0 comments on commit 9424c75

Please sign in to comment.