You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Noble Paul (JIRA)" <ji...@apache.org> on 2009/12/05 07:36:20 UTC

[jira] Issue Comment Edited: (SOLR-912) org.apache.solr.common.util.NamedList - Typesafe efficient variant - ModernNamedList introduced - implementing the same API as NamedList

    [ https://issues.apache.org/jira/browse/SOLR-912?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12786348#action_12786348 ] 

Noble Paul edited comment on SOLR-912 at 12/5/09 6:34 AM:
----------------------------------------------------------

bq.The performance numbers in here say a different story

I'm not referring to perf numbers here . It is memory efficiency. 

bq. As regarding Entry Objects being a memory hog - do we have some stats to back it up. 

We don't need stats for everything. we should know about how VM holds objects . 

Let me illustrate with a case of consider 5 key->values on a 32 bit m/c

NamedList(Backed by arraylist)
one Object []  + array size= 4 + 5 * 2*4 (bytes)  = 44 bytes + the overhead of ArrayList

ModernNamedList

one Object[] + 5 entry objects (16 bytes object overhead + each has 2 references of 4+4 bytes)+ array size () = 4 + 16*5+ 5*2*4 + 5*4  = 144 bytes+ the overhead of ArrayList   

Add to this the overhead of GC'ing 5 entry objects 

reference : http://www.cs.virginia.edu/kim/publicity/pldi09tutorials/memory-efficient-java-tutorial.pdf













      was (Author: noble.paul):
    bq.The performance numbers in here say a different story

I'm not referring to perf numbers here . It is memory efficiency. 

bq. As regarding Entry Objects being a memory hog - do we have some stats to back it up. 

We don't need stats for everything. we should know about how VM holds objects . 

Let me illustrate with a case of consider 5 key->values on a 32 bit m/c

NamedList(Backed by arraylist)
one Object []  + array size= 4 + 5 * 2*4 (bytes)  = 44 bytes + the overhead of ArrayList

ModernNamedList

one Object[] + 5 entry objects (each has 2 references of 4+4 bytes)+ array size () = 4 +  5*2*4 + 5*4  = 64 bytes+ the overhead of ArrayList   

Add to this the overhead of GC'ing 5 entry objects 












  
> org.apache.solr.common.util.NamedList - Typesafe efficient variant - ModernNamedList introduced - implementing the same API as NamedList
> ----------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SOLR-912
>                 URL: https://issues.apache.org/jira/browse/SOLR-912
>             Project: Solr
>          Issue Type: Improvement
>          Components: search
>         Environment: Tomcat 6, JRE 6, Solr 1.3+ nightlies 
>            Reporter: Kay Kay
>            Priority: Minor
>         Attachments: NLProfile.java, SOLR-912.patch, SOLR-912.patch
>
>   Original Estimate: 72h
>  Remaining Estimate: 72h
>
> The implementation of NamedList - while being fast - is not necessarily type-safe. I have implemented an additional implementation of the same - ModernNamedList (a type-safe variation providing the same interface as NamedList) - while preserving the semantics in terms of ordering of elements and allowing null elements for key and values (keys are always Strings , while values correspond to generics ). 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.