[
https://issues.apache.org/jira/browse/COUCHDB-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16057732#comment-16057732
]
ASF subversion and git services commented on COUCHDB-3358:
----------------------------------------------------------
Commit 4e5e84ecc20808df056163f6a147c154cdf75ee3 in couchdb's branch
refs/heads/master from [~tonysun83]
[ https://gitbox.apache.org/repos/asf?p=couchdb.git;h=4e5e84e ]
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.4.14#64029)