zhengruifeng commented on issue #25178: [SPARK-28421][ML] SparseVector.apply 
performance optimization
URL: https://github.com/apache/spark/pull/25178#issuecomment-514041986
 
 
   The expected cost without range check is `E(cost(apply2)) = log(NNZ)`;
   while the one with range check is `E(cost(apply3)) = 2 + P(key in 
range)*log(NNZ)`;
   The diff is `E(cost(apply3) - cost(apply2)) = 2 - P(key out of range) * 
log(NNZ)`, so the optimization is high related to the key distribution and the 
`NNZ`.
   The above suite suppose the input key is from an uniform distribution. And 
show that, if the `NNZ` is small, range check will cost extra 10% cost; 
otherwise, the range check will save about 50% cost.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to