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

Robert Muir commented on SOLR-2292:
-----------------------------------

Hossman: good idea to break out this issue. I found another trap that I think 
is actually even worse!

NamedList documents this limitation (the linear search by key) in this way:
{noformat}
 * If access by key is more important, see {...@link SimpleOrderedMap},
 * or simply use a regular {...@link Map}
{noformat}

So one might think SimpleOrderedMap wouldn't have these problems, especially 
from its documentation:
{noformat}
<code>SimpleOrderedMap</code> is a {...@link NamedList} where access by key is 
more
 * important than maintaining order when it comes to representing the
 * held data in other forms, as ResponseWriters normally do.
{noformat}

Yet SimpleOrderedMap only extends NamedList!!! Its still a linear search!
So we need to check uses of SimpleOrderedMap too, to look for n^2 bugs.


> Lock down NamedList API, remove inefficent and esoteric methods
> ---------------------------------------------------------------
>
>                 Key: SOLR-2292
>                 URL: https://issues.apache.org/jira/browse/SOLR-2292
>             Project: Solr
>          Issue Type: Task
>            Reporter: Hoss Man
>             Fix For: 3.1
>
>
> Over in SOLR-2288, rmuir made some good points about locking down the 
> NamedList API to protect people...
> {quote}
> I looked at your patch, and personally I think NamedList should really be 
> type-safe.
> If users want to use it in a type-unsafe way, thats fine, but *the container 
> itself shouldn't be List<Object>*.
> {quote}
> ...
> {quote}
> Separately, i just want to say the following about NamedList:
> All uses of this API should really be reviewed. I'm quite aware that it warns 
> you about the fact that its slow for certain operations,
> but in my opinion these *slow operations such as get(String, int) should be 
> deprecated and removed*.
> Any users that are using NamedList in this way, especially in loops, are very 
> likely using the wrong datastructure.
> {quote}
> (emphasis added by me)

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


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

Reply via email to