You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2017/04/05 07:31:41 UTC

[jira] [Commented] (COUCHDB-3358) Change O(n^2) function to be more performant

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

ASF subversion and git services commented on COUCHDB-3358:
----------------------------------------------------------

Commit 21cb0eb98bbf592a24456637429e5df6ce99ffc6 in couchdb's branch refs/heads/3358-use-efficient-set from [~tonysun83]
[ https://git-wip-us.apache.org/repos/asf?p=couchdb.git;h=21cb0eb ]

Use efficient set storage for field names

When indexing a set of fields for text search, we also create a special
field called $fieldnames. It contains values for all the fields that
need to be indexed. In order to do that, we need a unique list of the
form [[<<"$fieldnames">>, Name, [] | Rest]. The old code would add an
element to the list, and then check for membership via lists:member/2.
This is inefficient. Some documents can contain a large number of
fields, so we will use gb_sets to create a unique set of fields, and
then extract out the field names.

COUCHDB-3358


> Change O(n^2) function to be more performant
> --------------------------------------------
>
>                 Key: COUCHDB-3358
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-3358
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Mango
>            Reporter: Tony Sun
>            Assignee: Tony Sun
>
> This is related to this https://issues.apache.org/jira/browse/COUCHDB-2951. When a user has a document with lots of field names, or nested fields with arrays, we add these fields to a special $fieldnames field. However, as we add them , we're calling lists:member on that same Acc, making it a O(n^2) operation.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)