You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2013/04/30 01:00:16 UTC

[jira] [Commented] (UIMA-2434) Feature structure removal from sorted index is very slow

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

Marshall Schor commented on UIMA-2434:
--------------------------------------

array copy is now done using the Java built-in.

The problem with doing a binary search - the search is done using the compare order as defined by the sort.  When we find an ==, it means that the key values of the 2 feature structures are equal, but doesn't mean that the 2 feature structures are the same one (many different instances of feature structures could have the same "key" values).  Nevertheless, it's possible that a speedup could be done by using binary search, and then using sequential search from the "hit" spot (if any) to find the matching feature structure; this search would need to be in both directions, and proceed as long as the compare method says the feature structures have the same key values.
                
> Feature structure removal from sorted index is very slow
> --------------------------------------------------------
>
>                 Key: UIMA-2434
>                 URL: https://issues.apache.org/jira/browse/UIMA-2434
>             Project: UIMA
>          Issue Type: Improvement
>          Components: Core Java Framework
>    Affects Versions: 2.3.1SDK
>            Reporter: Mikhail Sogrin
>
> Removal of feature structures from sorted indexes (e.g. default index) is very slow. FSIntArrayIndex.remove() method performs two operations: linear search in the array until the given FS is found, followed by the shift of elements to the end of this array by one position to the left.
> If many annotations (millions and more) are being deleted at once, this operation gets very very slow - much slower than adding these annotations in the first place. It seems to require O(N^2) time to remove N annotations.
> One item is the linear search, which can be replaced by the binary search method, which is already implemented in the same class.
> Second, array copy can be done with Java built-in method instead of a custom loop.
> Ideally, a method for bulk removal of a collection of annotations would have been the most efficient, for example a method to remove all annotations of a given type.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira