You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "DM Smith (JIRA)" <ji...@apache.org> on 2008/08/28 21:25:44 UTC

[jira] Created: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Eliminate unnecessary uses of Hashtable and Vector
--------------------------------------------------

                 Key: LUCENE-1369
                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
             Project: Lucene - Java
          Issue Type: Improvement
    Affects Versions: 2.3.2
            Reporter: DM Smith
            Priority: Minor
             Fix For: 2.4


Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.

There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.

There are a few distinct usages of these classes:
# internal but with ArrayList or HashMap would do as well. These can simply be replaced.
# internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
# As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
# Generated by JavaCC. (All *.jj files.) Nothing to be done here.
# As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
# As a return value from a package protected method, but synchronization is not used. Change return type.
# As a return value to a final method. Change to List or Map.

In using a Vector the following iteration pattern is frequently used.
for (int i = 0; i < v.size(); i++) {
  Object o = v.elementAt(i);
}

This is an indication that synchronization is unimportant. The list could change during iteration.



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


[jira] Commented: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651964#action_12651964 ] 

Michael McCandless commented on LUCENE-1369:
--------------------------------------------

Ugh, that was definitely a break in back-compat -- my bad.

I missed that this change would mean we silently stop calling the Vector-based methods in subclasses.

I'll send an email to java-user.

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Commented: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628306#action_12628306 ] 

Michael McCandless commented on LUCENE-1369:
--------------------------------------------

This patch looks good, thanks DM!

The only issue I had was the addition of "implements PrecedenceQueryParserConstants" in PrecedenceQueryParser.jj:

{code}
  public class PrecedenceQueryParser implements PrecedenceQueryParserConstants {
{code}

When I ran javacc 3.2, which apparently also inserts its own "implements PrecedenceQueryParserConstants", it failed to compile.

I plan to commit in a day or two.

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Commented: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651894#action_12651894 ] 

Yonik Seeley commented on LUCENE-1369:
--------------------------------------

It's definitely iffy - that's why I didn't do these replacements in QueryParser when I did the others.

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Resolved: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-1369.
----------------------------------------

       Resolution: Fixed
    Lucene Fields: [New, Patch Available]  (was: [Patch Available, New])

Thanks DM!

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Commented: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651889#action_12651889 ] 

Mark Miller commented on LUCENE-1369:
-------------------------------------

Did we break our back compat guarantee here? This changes some protected signatures in queryparser. If someone was overriding them (which is what they are intended for), dropping in the new jar could cause hard to track down silent changes (the new method is called, the old one you may have overridden is not). There is a similar issue with adding more expressive range query syntax that I plan to finish up, so whats the verdict on these types of changes? Might as well do as many at once as we can if we are going to do it.

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Assigned: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "Michael McCandless (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless reassigned LUCENE-1369:
------------------------------------------

    Assignee: Michael McCandless

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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


[jira] Updated: (LUCENE-1369) Eliminate unnecessary uses of Hashtable and Vector

Posted by "DM Smith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-1369?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

DM Smith updated LUCENE-1369:
-----------------------------

    Attachment: LUCENE-1369.patch

> Eliminate unnecessary uses of Hashtable and Vector
> --------------------------------------------------
>
>                 Key: LUCENE-1369
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1369
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 2.3.2
>            Reporter: DM Smith
>            Priority: Minor
>             Fix For: 2.4
>
>         Attachments: LUCENE-1369.patch
>
>
> Lucene uses Vector, Hashtable and Enumeration when it doesn't need to. Changing to ArrayList and HashMap may provide better performance.
> There are a few places Vector shows up in the API. IMHO, List should have been used for parameters and return values.
> There are a few distinct usages of these classes:
> # internal but with ArrayList or HashMap would do as well. These can simply be replaced.
> # internal and synchronization is required. Either leave as is or use a collections synchronization wrapper.
> # As a parameter to a method where List or Map would do as well. For contrib, just replace. For core, deprecate current and add new method signature.
> # Generated by JavaCC. (All *.jj files.) Nothing to be done here.
> # As a base class. Not sure what to do here. (Only applies to SegmentInfos extends Vector, but it is not used in a safe manner in all places. Perhaps, implements List would be better.)
> # As a return value from a package protected method, but synchronization is not used. Change return type.
> # As a return value to a final method. Change to List or Map.
> In using a Vector the following iteration pattern is frequently used.
> for (int i = 0; i < v.size(); i++) {
>   Object o = v.elementAt(i);
> }
> This is an indication that synchronization is unimportant. The list could change during iteration.

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