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

Uwe Schindler edited comment on LUCENE-10129 at 10/15/21, 12:04 PM:
--------------------------------------------------------------------

bq. I am wondering though if TestRamUsageEstimator is missing an import static 
org.apache.lucene.util.RamUsageEstimator.sizeOf;, so that in lines like 
assertEquals(sizeOf(array), sizeOf((Object) array)); the first sizeOf() calls 
RamUsageEstimator.sizeOf, and the second calls RamUsageTester.sizeOf. Apologies 
if I misunderstood the purpose of the test.

I was also stumbling on this. Maybe we should remove the static import and be 
explicit and compare all three versions?


was (Author: thetaphi):
bq. I am wondering though if TestRamUsageEstimator is missing an import static 
org.apache.lucene.util.RamUsageEstimator.sizeOf;, so that in lines like 
assertEquals(sizeOf(array), sizeOf((Object) array)); the first sizeOf() calls 
RamUsageEstimator.sizeOf, and the second calls RamUsageTester.sizeOf.
Apologies if I misunderstood the purpose of the test.

I was also stumbling on this. Maybe we should remove the static import and be 
explicit and compare all three versions?

> 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
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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