CouchDB
  1. CouchDB
  2. COUCHDB-1027

More efficient implementation of the DB updater BTree functions

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.1, 1.2, 2.0.0
    • Component/s: Database Core
    • Labels:
      None

      Description

      Currently, some of the BTree functions (by_id BTree reduce function and and by_seq BTree split function) traverse the same input lists several times to produce the output. This is not optimal. For example, the btree_by_id_reduce function, for a database with 300 000+ documents, can easily get a list of 50 or more #full_doc_info records. This functions traverses that list 4 times - 2 filtered list comprehensions plus two length/1 calls.

      The following patch changes the implementation to produce the same output with a single list traversal operation.

        Activity

        Hide
        Randall Leeds added a comment -

        Nice! I bet there's more like this lurking around.

        Show
        Randall Leeds added a comment - Nice! I bet there's more like this lurking around.
        Filipe Manana made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.1 [ 12314933 ]
        Fix Version/s 1.2 [ 12315198 ]
        Fix Version/s 2.0 [ 12315572 ]
        Resolution Fixed [ 1 ]
        Hide
        Filipe Manana added a comment -

        Applied to trunk and branch 1.1.x

        Show
        Filipe Manana added a comment - Applied to trunk and branch 1.1.x
        Filipe Manana made changes -
        Field Original Value New Value
        Attachment COUCHDB-1027.patch [ 12468546 ]
        Filipe Manana created issue -

          People

          • Assignee:
            Filipe Manana
            Reporter:
            Filipe Manana
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development