-
Notifications
You must be signed in to change notification settings - Fork 641
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
Factored out WeakDictionary in favor of weak events using Prism.Core #613
Conversation
…ions class to provide a workaround for the lack of AddOrUpdate on .NET Standard 2.0 and prior
…Factored out WeakDictionary and use external locking to fixup AddOrUpdate where it is not supported.
…tionary and use external locking to fixup AddOrUpdate where it is not supported.
…lude fields from being considered in the calculation
…gator to handle getting estimated RAM usage on .NET Standard 2.0 and .NET Framework
… retrieve weak DocIdSet references on .NET Standard 2.0 and .NET Framework
…tting parent readers weakly on .NET Standard 2.0 and .NET Framework
…e AddCacheEntries by retrieving the keys via weak events and then updating the values one at a time on .NET Standard 2.0 and .NET Framework.
WOW! You are amazing! |
I second the WOW! comment, can't believe you find a solution for this... |
Even though it's not relevant for me (I'm using net core for years), |
Not sure. Being that However, testing on .NET Framework seems to have settled at around 1-2 min longer than .NET 5, where before it varied and was for the most part around 14 minutes instead of around 11-12 minutes. |
…ParentReadersEvent and GetCacheKeysEvent declarations to decouple references between consumers.
…heKeysEvent to avoid the need for a finalizer on CachedOrds and additional event declaration
…ent to avoid the need for a finalizer on DocIdSet and an additional event declaration
…gistered multiple times, and will track the registrations to clean them up during Dispose()
I have altered this a bit:
So, this basically avoids any finalizer calls to enable the weak event functionality. But even if that were not so, avoiding the huge overhead of re-allocating a Dictionary repeatedly by relying only on |
Closes #256, #604, and #605.
This removes the
Lucene.Net.Support.WeakDictionary<TKey, TValue>
class (and its tests) that were carried over from Lucene.Net 3.0.3, and completely replaces it on .NET Standard 2.0 and .NET Framework withConditionalWeakTable<TKey, TValue>
. Since the enumerator was not available on .NET Standard 2.0 and prior, this workaround uses weak events from Prism.Core to either call methods or return strong references to types that are inside of theConditionalWeakTable<TKey, TValue>
.This adds an
AddOrUpdate
extension method (non-threadsafe) for cases where a "put" is required.Also adds
Lucene.Net.Util.ExcludeFromRamUsageEstimationAttribute
to mark fields so they don't get included in the calculation (which prevents infinite recursion on the event fields).