Skip to content

Improve performance of trim expressions #2977

@andygrove

Description

@andygrove

What is the problem the feature request solves?

CometStringExpressionBenchmark shows poor performance:

OpenJDK 64-Bit Server VM 11.0.22+7-LTS on Mac OS X 14.6.1
Apple M3 Max
trim:                                     Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                10             50          21          0.1        9794.1       1.0X
Comet (Scan)                                         11             43          31          0.1       10672.9       0.9X
Comet (Scan + Exec)                                  15             63          23          0.1       14389.7       0.7X

OpenJDK 64-Bit Server VM 11.0.22+7-LTS on Mac OS X 14.6.1
Apple M3 Max
btrim:                                    Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                 9             33          24          0.1        9219.6       1.0X
Comet (Scan)                                         27             72          24          0.0       26224.5       0.4X
Comet (Scan + Exec)                                  15             74          40          0.1       14454.3       0.6X

OpenJDK 64-Bit Server VM 11.0.22+7-LTS on Mac OS X 14.6.1
Apple M3 Max
ltrim:                                    Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                10             77          30          0.1        9671.0       1.0X
Comet (Scan)                                         10             70          19          0.1        9802.0       1.0X
Comet (Scan + Exec)                                  16             85          26          0.1       15813.0       0.6X

OpenJDK 64-Bit Server VM 11.0.22+7-LTS on Mac OS X 14.6.1
Apple M3 Max
rtrim:                                    Best Time(ms)   Avg Time(ms)   Stdev(ms)    Rate(M/s)   Per Row(ns)   Relative
------------------------------------------------------------------------------------------------------------------------
Spark                                                 9             26          28          0.1        8771.6       1.0X
Comet (Scan)                                          9             49          33          0.1        9270.0       0.9X
Comet (Scan + Exec)                                  14             56          40          0.1       13827.8       0.6X

Describe the potential solution

Review benchmark to make sure it is valid, then try and optimize.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions