You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Stefan Vodita (Jira)" <ji...@apache.org> on 2021/10/08 10:33:00 UTC

[jira] [Commented] (LUCENE-10129) Add RamUsageEstimator shallowSizeOf(long[]) overload that just calls sizeOf(long[])?

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

Stefan Vodita commented on LUCENE-10129:
----------------------------------------

Hello! I am new to Lucene, and this looked like an easy task to start with, so I published [a PR|http://example.com] for it.


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.

> 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-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org