Skip to content

[opt](expr) Remove FixedContainer optimization for StringValueSet#62243

Open
Mryange wants to merge 2 commits intoapache:masterfrom
Mryange:remove-fixed-string-set
Open

[opt](expr) Remove FixedContainer optimization for StringValueSet#62243
Mryange wants to merge 2 commits intoapache:masterfrom
Mryange:remove-fixed-string-set

Conversation

@Mryange
Copy link
Copy Markdown
Contributor

@Mryange Mryange commented Apr 8, 2026

What problem does this PR solve?

Benchmark results show that FixedContainer (SIMD linear scan) is slower than DynamicContainer (hash set) for std::string/StringRef when N >= 2. The FixedContainer optimization only benefits integer types at small sizes, but hurts string lookups due to expensive comparisons scaling linearly with N.

This PR removes the FixedContainer specialization from create_string_value_set, always using the hash-based DynamicContainer instead.

Additionally fixes deprecated DoNotOptimize warnings in benchmark files and adds a new FixedContainer vs DynamicContainer benchmark.

Fixed_Int32_N1                                                                          5.28 us         5.25 us       100000
Dynamic_Int32_N1                                                                        29.4 us         29.1 us        23538
Fixed_Int32_N2                                                                          15.7 us         15.6 us        46383
Dynamic_Int32_N2                                                                        41.4 us         41.2 us        16213
Fixed_Int32_N3                                                                          25.7 us         25.6 us        27386
Dynamic_Int32_N3                                                                        45.9 us         45.5 us        14574
Fixed_Int32_N4                                                                          9.45 us         9.40 us        79614
Dynamic_Int32_N4                                                                        40.5 us         40.3 us        15873
Fixed_Int32_N5                                                                          22.9 us         22.8 us        29587
Dynamic_Int32_N5                                                                        46.5 us         46.3 us        14624
Fixed_Int32_N6                                                                          31.5 us         31.3 us        22306
Dynamic_Int32_N6                                                                        46.5 us         46.3 us        14851
Fixed_Int32_N7                                                                          41.6 us         41.4 us        17142
Dynamic_Int32_N7                                                                        56.1 us         55.8 us        12542
Fixed_Int32_N8                                                                          11.1 us         11.1 us        70730
Dynamic_Int32_N8                                                                        43.3 us         42.1 us        12838
Fixed_Int64_N1                                                                          5.91 us         5.88 us       121146
Dynamic_Int64_N1                                                                        41.5 us         41.3 us        19183
Fixed_Int64_N2                                                                          16.0 us         16.0 us        47690
Dynamic_Int64_N2                                                                        40.2 us         40.0 us        18290
Fixed_Int64_N3                                                                          27.0 us         26.9 us        27097
Dynamic_Int64_N3                                                                        46.9 us         46.6 us        15495
Fixed_Int64_N4                                                                          24.8 us         24.6 us        28495
Dynamic_Int64_N4                                                                        40.5 us         40.2 us        17581
Fixed_Int64_N5                                                                          39.9 us         39.6 us        18133
Dynamic_Int64_N5                                                                        47.4 us         47.2 us        14943
Fixed_Int64_N6                                                                          45.8 us         45.5 us        15396
Dynamic_Int64_N6                                                                        49.2 us         48.9 us        14062
Fixed_Int64_N7                                                                          55.0 us         54.8 us        12726
Dynamic_Int64_N7                                                                        57.6 us         57.3 us        12673
Fixed_Int64_N8                                                                          14.5 us         14.4 us        48230
Dynamic_Int64_N8                                                                        40.3 us         40.1 us        17560
Fixed_String_N1                                                                          243 us          242 us         2884
Dynamic_String_N1                                                                       1364 us         1358 us          516
Fixed_String_N2                                                                         1195 us         1189 us          591
Dynamic_String_N2                                                                        739 us          736 us          946
Fixed_String_N3                                                                          163 us          163 us         4433
Dynamic_String_N3                                                                        226 us          225 us         3257
Fixed_String_N4                                                                          214 us          213 us         3290
Dynamic_String_N4                                                                        205 us          204 us         3437
Fixed_String_N5                                                                          266 us          265 us         2634
Dynamic_String_N5                                                                        220 us          219 us         2900
Fixed_String_N6                                                                          313 us          312 us         2246
Dynamic_String_N6                                                                        220 us          219 us         3195
Fixed_String_N7                                                                          362 us          360 us         1962
Dynamic_String_N7                                                                        234 us          233 us         3008
Fixed_String_N8                                                                         2586 us         2575 us          274
Dynamic_String_N8                                                                        213 us          212 us         3350

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@Thearas
Copy link
Copy Markdown
Contributor

Thearas commented Apr 8, 2026

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@Mryange
Copy link
Copy Markdown
Contributor Author

Mryange commented Apr 8, 2026

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

BE Regression && UT Coverage Report

Increment line coverage 61.76% (21/34) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 73.75% (27410/37165)
Line Coverage 57.32% (295579/515639)
Region Coverage 54.51% (245943/451215)
Branch Coverage 56.24% (106762/189817)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants