-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Use FrozenDictionary #15040
Use FrozenDictionary #15040
Conversation
How is this a performance gain? Sorry for being curious |
@dannyd89 it was based on a convo I had with @sebastienros . Although I think he suggested to use FrozenDictionary. We'll probably need to do a pref testing with .net 8. |
This PR is creating the collections/dictionaries once so this is fine. Better use |
@dannyd89 FrozenDictionary are optimized for read and provide a better lookup performance. However, they are more expensive to create. The changes in the PR create the dictionary only once and make cache it. This means we pay the high cost for creating it once but improve the repeated lookup against. But yes, we should not use ImmuableDictionary since it's much slower. Here is a benchmark I just did against different dictionary using 10k items with a string key and doing about 1000 lookups against the https://startdebugging.net/2023/08/net-8-performance-dictionary-vs-frozendictionary/ |
Yeah the benchmark really paints the picture, thanks! Are there currently some works to improve the performance of OC in general? Any tracking issues where I could also contribute? |
@dannyd89 there isn't really a list of performance based issues for OC. We like to merge PR #14572 as it is expected to bring notable improvement since serialization and deserialization is something we heavily use in OC and YesSql. If you want to improve OC, the todo list is quite lengthy. you can filter by |
src/OrchardCore.Modules/OrchardCore.Search.Lucene/Services/LuceneIndexManager.cs
Outdated
Show resolved
Hide resolved
NB: You see how the |
@sebastienros It would be nice to see if the signification performance gain when switching to Immutable collections when possible.
I am guessing we'll only see real difference if we have lots of parts registered