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

Optimize WT short key comparison function __wt_lex_compare_short

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Not Applicable
    • Storage Engines
    • Nick - 2024-04-30

      __wt_lex_compare_short is often a hot function, especially for queries which do repeated seek() operations, as it's called each time we compare a key on a page with the desired key. It is essentially memcmp(), specialized for inputs of up to 9 bytes long.

      The current implementation operates byte-by-byte. It would be worth spending some time micro-benchmarking and optimizing this function, perhaps even in architecture-specific ways. For example, we can do multiple comparisons at once, by loading several bytes into an integer, and comparing the integers (though this depends on the system endianness). It may also be better to just call the generic memcmp() directly.

       

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            ian.boros@mongodb.com Ian Boros
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: