lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [lucenenet] theolivenbaum opened a new issue #377: Use pooling on BooleanScorer.BucketTable
Date Mon, 19 Oct 2020 19:31:50 GMT

theolivenbaum opened a new issue #377:
URL: https://github.com/apache/lucenenet/issues/377


   I've measured some significant number of allocations due to the usage of BooleanScorer,
that can trace back to the inner class [BucketTable](https://github.com/apache/lucenenet/blob/081edeed35b190c1d535dcfdfeb91143f0ef818f/src/Lucene.Net/Search/BooleanScorer.cs#L134)
   
   `````csharp
           internal sealed class BucketTable
           {
               public static readonly int SIZE = 1 << 11;
               public static readonly int MASK = SIZE - 1;
   
               internal readonly Bucket[] buckets = new Bucket[SIZE];
               internal Bucket first = null; // head of valid list
   
               public BucketTable()
               {
                   // Pre-fill to save the lazy init when collecting
                   // each sub:
                   for (int idx = 0; idx < SIZE; idx++)
                   {
                       buckets[idx] = new Bucket();
                   }
               }
   `````
   
   I've experimented today with using an object pool to avoid repeatedly allocating BucketTable
instances, and the only public API change is for BulkScorer to implement IDisposable. 
   
   @NightOwl888 any immediate restrictions against it? If not happy to open a pull request.
   
    
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message