Skip to content

[Enhancement] Optimization for string_search #7998

@BiteTheDDDDt

Description

@BiteTheDDDDt

Search before asking

  • I had searched in the issues and found no similar issues.

Description

I tried to use std::search to replace custom search implement, have 100%+ faster on build with clang(also have some improve on gcc).

before:

MySQL [ssb]> select sum(locate('LO',lo_orderpriority)) from lineorder;
+---------------------------------------+
| sum(locate('LO', `lo_orderpriority`)) |
+---------------------------------------+
|                             360039444 |
+---------------------------------------+
1 row in set (19.040 sec)

MySQL [ssb]> select sum(locate('-',lo_orderpriority)) from lineorder;
+--------------------------------------+
| sum(locate('-', `lo_orderpriority`)) |
+--------------------------------------+
|                           1200075804 |
+--------------------------------------+
1 row in set (15.214 sec)

MySQL [ssb]> select sum(locate('HIGH',lo_orderpriority)) from lineorder;
+-----------------------------------------+
| sum(locate('HIGH', `lo_orderpriority`)) |
+-----------------------------------------+
|                               359987466 |
+-----------------------------------------+
1 row in set (19.574 sec)

after:

MySQL [ssb]> select sum(locate('LO',lo_orderpriority)) from lineorder;
+---------------------------------------+
| sum(locate('LO', `lo_orderpriority`)) |
+---------------------------------------+
|                             360039444 |
+---------------------------------------+
1 row in set (11.004 sec)

MySQL [ssb]> select sum(locate('-',lo_orderpriority)) from lineorder;
+--------------------------------------+
| sum(locate('-', `lo_orderpriority`)) |
+--------------------------------------+
|                           1200075804 |
+--------------------------------------+
1 row in set (7.888 sec)

MySQL [ssb]> select sum(locate('HIGH',lo_orderpriority)) from lineorder;
+-----------------------------------------+
| sum(locate('HIGH', `lo_orderpriority`)) |
+-----------------------------------------+
|                               359987466 |
+-----------------------------------------+
1 row in set (10.952 sec)

Solution

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions