Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-12856

Avoid null checking collator each time when compare keys

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Storage Engines
    • StorEng - Defined Pipeline

      /*
       * __wt_compare_skip --
       *     The same as __wt_lex_compare_skip, but using the application's collator function when
       *     configured.
       */
      static WT_INLINE int
      __wt_compare_skip(WT_SESSION_IMPL *session, WT_COLLATOR *collator, const WT_ITEM *user_item,
        const WT_ITEM *tree_item, int *cmpp, size_t *matchp)
      {
          if (collator == NULL) {
              *cmpp = __wt_lex_compare_skip(session, user_item, tree_item, matchp);
              return (0);
          }
          return (collator->compare(collator, &session->iface, user_item, tree_item, cmpp));
      }
      

      We use this code to compare the keys based on whether we have a collator or not. We do this each time when we compare the two keys. Ideally, we should be able to set on the btree that which function we should use when we open the btree. We can then avoid calling this code for each comparison.

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            chenhao.qu@mongodb.com Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: