Riza Suminto has posted comments on this change. ( 
http://gerrit.cloudera.org:8080/18091 )

Change subject: IMPALA-11057: Speed to hex_int function
......................................................................


Patch Set 5:

(1 comment)

Hello!
Thank you for your interest in improving this function. This is great!
Impala have benchmarking program to evaluate expression evaluation performance 
at be/src/benchmarks/expr-benchmark.cc.
Running BenchmarkMathFunctions, I can see roughly 12x performance increase in 
non-codegen expression and 15x performance improvement in codegened expression 
for hex_int with your patch set 5.

I'd like to suggest one more improvement, if it's OK.

http://gerrit.cloudera.org:8080/#/c/18091/5/be/src/exprs/math-functions-ir.cc
File be/src/exprs/math-functions-ir.cc:

http://gerrit.cloudera.org:8080/#/c/18091/5/be/src/exprs/math-functions-ir.cc@246
PS5, Line 246:   char ans[17];
You can write the result immediately to StringVal struct to avoid unnecessary 
copying at AnyValUtil::FromString.
Initialization will be like this:
StringVal ans(ctx, 17);

Iterating the char buffer can be done by referencing ans.ptr, such as:
char* ptr = reinterpret_cast<char*>(ans.ptr);
*(ptr + i) = hex[num & 15];

And truncating the resulting StringVal can be done with:
ans.Resize(ctx, i);

I test this method and performance increase by 23x for codegened expression in 
expr-benchmark.cc



--
To view, visit http://gerrit.cloudera.org:8080/18091
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Icf2dc7ea64b60b24f1a9e6ab53725acd40ce88ac
Gerrit-Change-Number: 18091
Gerrit-PatchSet: 5
Gerrit-Owner: Anonymous Coward <[email protected]>
Gerrit-Reviewer: Anonymous Coward <[email protected]>
Gerrit-Reviewer: Impala Public Jenkins <[email protected]>
Gerrit-Reviewer: Kurt Deschler <[email protected]>
Gerrit-Reviewer: Riza Suminto <[email protected]>
Gerrit-Comment-Date: Thu, 16 Dec 2021 05:21:58 +0000
Gerrit-HasComments: Yes

Reply via email to