Github user eladmarg commented on a diff in the pull request:

    https://github.com/apache/lucenenet/pull/188#discussion_r81007019
  
    --- Diff: src/Lucene.Net.Facet/Taxonomy/LRUHashMap.cs ---
    @@ -100,19 +120,25 @@ public bool Put(TKey key, TValue value)
                             timestamp = GetTimestamp()
                         };
                         // We have added a new item, so we may need to remove 
the eldest
    -                    if (cache.Count > Capacity)
    +                    if (cache.Count > capacity)
                         {
                             // Remove the eldest item (lowest timestamp) from 
the cache
                             cache.Remove(cache.OrderBy(x => 
x.Value.timestamp).First().Key);
    --- End diff --
    
    This is working great, however, I think this will cause performance penalty 
on every put.
    sometimes there are many items in the cache so each Put operation will 
cause expensive sorting.
    in my previous implementation (I removed the PR), there is CleanPercentage, 
(so each clean we remove 10-15 percent).  
    so a simple Take and remove will do the job, so we'll do cleaning less 
frequently.
    amazing job!



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to