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

Robert Muir commented on LUCENE-10129:
--------------------------------------

{noformat}
  public org.apache.lucene.util.SparseFixedBitSet(int);
    Code:
       0: aload_0
       1: invokespecial #13                 // Method 
org/apache/lucene/util/BitSet."<init>":()V
       4: iload_1
       5: iconst_1
       6: if_icmpge     19
       9: new           #16                 // class 
java/lang/IllegalArgumentException
      12: dup
      13: ldc           #18                 // String length needs to be >= 1
      15: invokespecial #20                 // Method 
java/lang/IllegalArgumentException."<init>":(Ljava/lang/String;)V
      18: athrow
      19: aload_0
      20: iload_1
      21: putfield      #23                 // Field length:I
      24: iload_1
      25: invokestatic  #27                 // Method blockCount:(I)I
      28: istore_2
      29: aload_0
      30: iload_2
      31: newarray       long
      33: putfield      #31                 // Field indices:[J
      36: aload_0
      37: iload_2
      38: anewarray     #35                 // class "[J"
      41: putfield      #36                 // Field bits:[[J
      44: aload_0
      45: getstatic     #40                 // Field BASE_RAM_BYTES_USED:J
      48: aload_0
      49: getfield      #31                 // Field indices:[J
      52: invokestatic  #44                 // Method 
org/apache/lucene/util/RamUsageEstimator.sizeOf:([J)J
      55: ladd
      56: aload_0
      57: getfield      #36                 // Field bits:[[J
      60: invokestatic  #50                 // Method 
org/apache/lucene/util/RamUsageEstimator.shallowSizeOf:([Ljava/lang/Object;)J
      63: ladd
      64: putfield      #54                 // Field ramBytesUsed:J
      67: return
{noformat}

> Add RamUsageEstimator shallowSizeOf(long[]) overload that just calls 
> sizeOf(long[])?
> ------------------------------------------------------------------------------------
>
>                 Key: LUCENE-10129
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10129
>             Project: Lucene - Core
>          Issue Type: Task
>            Reporter: Robert Muir
>            Priority: Major
>
> See LUCENE-10128 for an example. The problem is there is only a 
> {{sizeOf(long[])}}, so if the programmer uses {{shallowSizeOf}} instead of 
> {{sizeOf}} then it falls back to {{shallowSizeOf(Object)}} which does a bunch 
> of reflection.
> This is pretty crazy because it can create performance traps. Should we just 
> add a {{shallowSizeOf(long[])}} that calls {{sizeOf(long[])}}, so that things 
> are fast? (same for other primitive arrays). It would solve the problem 
> easily I think.



--
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