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

Improve Add/Attach performance for large graphs #487

Merged
merged 7 commits into from
Feb 7, 2024

Conversation

Daniel-Svensson
Copy link
Member

@Daniel-Svensson Daniel-Svensson commented Feb 3, 2024

Makes adding n entities to an EntityCollection or similar roughly O(n) instead of O(n²)

Commit 1-2 are based on perf data from #450

Commit 3 is mostly code cleanup, with some minor perf improvements

The performance for adding 20 000 entities to an EntityCollection is improved by more than 100x (just for commit 2)

Commit 2 performance difference:

With only commit 1 & 3 With commit 1,2,3 diff
time 35s 314ms >111 times better
allocated 18 624 MB 85 MB > 200 times better

@Daniel-Svensson Daniel-Svensson changed the title Entity perf Improve Add/Attach performance for large graphs Feb 4, 2024
@Daniel-Svensson Daniel-Svensson marked this pull request as ready for review February 4, 2024 13:42
* Use result of HashSet.Add instead of checking Contains before Add
* Make ListCollectionViewProxy smarter
  * remove IndexOf from Add for O(1) instead of O(n) performance
  * Contains use hashSet contains instead of IndeOf for O(1) instead of O(n) performance
  * Remove argument range check
@Daniel-Svensson Daniel-Svensson enabled auto-merge (squash) February 7, 2024 21:03
Copy link

sonarcloud bot commented Feb 7, 2024

@Daniel-Svensson Daniel-Svensson merged commit 069a03f into OpenRIAServices:main Feb 7, 2024
5 checks passed
@Daniel-Svensson Daniel-Svensson deleted the entity_perf branch February 7, 2024 21:20
@Daniel-Svensson Daniel-Svensson added this to the 5.4.3 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant