Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-37849

UCA: Change "skip equal simple prefix" to "compare simple prefix"

    XMLWordPrintable

Details

    Description

      The UCA implementation uses optimization for ASCII-compatible character sets (utf8mb3, utf8mb4) mainly implemented in the function my_uca_level_booster_equal_prefix_length(). The idea is that if two strings have equal (according to the collation) simple prefix, it can be skipped quickly before the comparison enters a havier slower loop.

      This optimization uses the member MY_UCA_LEVEL_BOOSTER::weight_strings_2bytes_to_1_or_2_weights.

      "Simple" means that the data in the prefix has only:

      • ASCII or 2-byte characters
      • The data can be traversed two bytes at a time (i.e. there are no ASCII followed by MB2 head at an odd position)
      • Each two bytes producing one or two weights

      The data does not have any of the following features:

      • Non-ASCII characters with octet length more than two
      • Ignorable characters
      • Contraction heads
      • Expansions producing more than two weights
      • Context-dependent characters

      Skipping the equal prefix optimizes well when we compare equal strings. However it's not good if we compare different strings massively (e.g. during sorting of an array of different strings).

      Let's change the "skip equal simple prefix" approach to "compare simple prefix". The member MY_UCA_LEVEL_BOOSTER::weight_strings_2bytes_to_1_or_2_weights has almost everything for this.

      After changes are done the implementer should make sure it make benchmark faster. Running rt_order_ranges.lua in sysbench on a utf8mb4_uca1400_ai_ci database should be good for performance testing.

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.