lucenenet-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [lucenenet] theolivenbaum commented on issue #346: Remove Debugging.AssertsEnabled
Date Sat, 17 Oct 2020 16:49:58 GMT

theolivenbaum commented on issue #346:

   @NightOwl888  I'm reviewing my previous benchmarks on our usage of Lucene today, and I
think my initial conclusion on Debugging.AssertsEnabled being the cause of the "slowness"
of FixedBitSet.Set / Get is actually incorrect.
   Using dotMemory now to measure memory allocations, one can clearly see that there is a
lambda capture being allocated on every call to the FixedBitSet.Set / Get methods.
   This can also be seen on [SharpLab](
if we look at the decompiled C# code:
   public class FixedBitSet
       private sealed class <>c__DisplayClass3_0
           public int index;
           public FixedBitSet <>4__this;
           internal string <Set>b__0()
               return "index=" + index + ", numBits=" + <>4__this.numBits;
       internal readonly long[] bits;
       internal readonly int numBits;
       internal readonly int numWords;
       public void Set(int index)
           <>c__DisplayClass3_0 <>c__DisplayClass3_ = new <>c__DisplayClass3_0();
   <------ unnecessary allocation, probably due to the capture of numBits
           <>c__DisplayClass3_.index = index;
           <>c__DisplayClass3_.<>4__this = this;
           if (Debugging.AssertsEnabled)
               Debugging.Assert(<>c__DisplayClass3_.index >= 0 && <>c__DisplayClass3_.index
< numBits, new Func<string>(<>c__DisplayClass3_.<Set>b__0));
           int num = <>c__DisplayClass3_.index >> 6;
           int num2 = <>c__DisplayClass3_.index & 0x3F;
           long num3 = 1L << num2;
           bits[num] |= num3;
   @NightOwl888 I'll push a pull request with only the fix for this asap

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:

View raw message