[ 
https://issues.apache.org/jira/browse/LUCENE-9673?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17281862#comment-17281862
 ] 

Michael McCandless commented on LUCENE-9673:
--------------------------------------------

I was curious if this impacted indexing throughput and ran `luceneutil` three 
times with this change (confusingly, named `trunkN.txt` below) and three times 
without this change (`baseN.log`):

```

[mike@beast3 trunk]$ grep "indexing done" /l/logs/trunk?.txt

/l/logs/trunk1.txt:Indexer: indexing done (89114 msec); total 27624170 docs

/l/logs/trunk2.txt:Indexer: indexing done (89974 msec); total 27624192 docs

/l/logs/trunk3.txt:Indexer: indexing done (90614 msec); total 27624409 docs

[mike@beast3 trunk]$ grep "indexing done" /l/logs/base?.log

/l/logs/base1.log:Indexer: indexing done (89271 msec); total 27623915 docs

/l/logs/base2.log:Indexer: indexing done (91676 msec); total 27624107 docs

/l/logs/base3.log:Indexer: indexing done (93120 msec); total 27624268 docs

```

Possibly a small speedup, but within the noise/variance of the test.  Plus, the 
precise doc count indexed changes each time, which is not right!  I opened 
[https://github.com/mikemccand/luceneutil/issues/106] to get to the bottom of 
that ...

> The level of IntBlockPool slice is always 1 
> --------------------------------------------
>
>                 Key: LUCENE-9673
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9673
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/other
>            Reporter: mashudong
>            Priority: Minor
>         Attachments: LUCENE-9673.patch
>
>
> First slice is allocated by IntBlockPoo.newSlice(), and its level is 1,
>  
> {code:java}
> private int newSlice(final int size) {
>  if (intUpto > INT_BLOCK_SIZE-size) {
>  nextBuffer();
>  assert assertSliceBuffer(buffer);
>  }
>  
>  final int upto = intUpto;
>  intUpto += size;
>  buffer[intUpto-1] = 1;
>  return upto;
> }{code}
>  
>  
> If one slice is not enough, IntBlockPoo.allocSlice() is called to allocate 
> more slices,
> as the following code shows, level is 1, newLevel is NEXT_LEVEL_ARRAY[0] 
> which is also 1.
>  
> The result is the level of IntBlockPool slice is always 1, the first slice is 
>  2 bytes long, and all subsequent slices are 4 bytes long.
>  
> {code:java}
> private static final int[] NEXT_LEVEL_ARRAY = {1, 2, 3, 4, 5, 6, 7, 8, 9, 9};
> private int allocSlice(final int[] slice, final int sliceOffset) {
>  final int level = slice[sliceOffset];
>  final int newLevel = NEXT_LEVEL_ARRAY[level - 1];
>  final int newSize = LEVEL_SIZE_ARRAY[newLevel];
>  // Maybe allocate another block
>  if (intUpto > INT_BLOCK_SIZE - newSize) {
>  nextBuffer();
>  assert assertSliceBuffer(buffer);
>  }
> final int newUpto = intUpto;
>  final int offset = newUpto + intOffset;
>  intUpto += newSize;
>  // Write forwarding address at end of last slice:
>  slice[sliceOffset] = offset;
> // Write new level:
>  buffer[intUpto - 1] = newLevel;
> return newUpto;
>  } 
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to