[ 
https://issues.apache.org/jira/browse/HIVE-10238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14682061#comment-14682061
 ] 

Teddy Choi commented on HIVE-10238:
-----------------------------------

Dear [~chengxiang li]. My benchmark results shows the bitwise operator 
optimization makes {{IfExprLongColumnLongColumn}} 44% faster. I still need to 
clean code for {{IfExprDoubleColumnDoubleColumn}}. I will make a patch file 
later. Thanks.

Main difference:
{code}
outputVector[i] = (~(vector1[i] - 1) & vector2[i]) | ((vector1[i] - 1) & 
vector3[i]);
{code}

Performance before patch:
{noformat}
o.a.h.b.v.VectorizationBench.IfExprLongColumnLongColumnBench.bench              
avgt        2  2957210719.500 ±   NaN  ns/op
{noformat}

Performance after patch:
{noformat}
o.a.h.b.v.VectorizationBench.IfExprLongColumnLongColumnBench.bench              
avgt        2  2048923771.000 ±   NaN  ns/op
{noformat}



> Loop optimization for SIMD in IfExprColumnColumn.txt
> ----------------------------------------------------
>
>                 Key: HIVE-10238
>                 URL: https://issues.apache.org/jira/browse/HIVE-10238
>             Project: Hive
>          Issue Type: Sub-task
>          Components: Vectorization
>    Affects Versions: 1.1.0
>            Reporter: Chengxiang Li
>            Assignee: Chengxiang Li
>            Priority: Minor
>
> The ?: operator as following could not be vectorized in loop, we may transfer 
> it into mathematical expression.
> {code:java}
> for(int j = 0; j != n; j++) {
>       int i = sel[j];
>       outputVector[i] = (vector1[i] == 1 ? vector2[i] : vector3[i]);
>       outputIsNull[i] = (vector1[i] == 1 ?
>           arg2ColVector.isNull[i] : arg3ColVector.isNull[i]);
> }
> {code} 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to