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

Small perf improvements for cursor caching

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.3.0, 8.1.0-rc0, 8.0.0-rc6
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Storage Engines
    • v8.0

      As part of looking at WT-12153, I noticed some small fixes that could be made:

      First, the macro WT_HANDLE_CAN_REOPEN is written:

          (!F_ISSET(dhandle, WT_DHANDLE_DEAD | WT_DHANDLE_DROPPED) && F_ISSET(dhandle, WT_DHANDLE_OPEN))
       

      This compiles (ARM/gcc/release) to having two tests and two branches.
      But I think if we write it as:

         (F_MASK(dhandle, WT_DHANDLE_DEAD | WT_DHANDLE_DROPPED | WT_DHANDLE_OPEN) == WT_DHANDLE_OPEN)
      

      it should compile to a single branch.

      Second, __wt_session_lock_dhandle returns a "is_dead" value. That's redundant
      with the WT_DHANDLE_DEAD flag in dhandle->flags. We check it in the same if conditional, so it's a redundant check, I don't think the compiler can detect that.

      Third, __wt_cursor_reopen checks to see if dhandle is NULL. I believe it cannot be null, we can change the check to an assert.

      I think that these together may get rid of 3 branches.

            Assignee:
            donald.anderson@mongodb.com Donald Anderson
            Reporter:
            donald.anderson@mongodb.com Donald Anderson
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: