# HG changeset patch # User Arun Giridhar # Date 1663163971 14400 # Node ID 0dec459a40643742402518e089894ea099714b15 # Parent 44cf6bbeeca91d028c74a3737b3916d5f23ba0a2 sparse-xpow.cc: Performance tweak for threshold selection diff -r 44cf6bbeeca9 -r 0dec459a4064 libinterp/corefcn/sparse-xpow.cc --- a/libinterp/corefcn/sparse-xpow.cc Mon Sep 12 05:35:48 2022 -0400 +++ b/libinterp/corefcn/sparse-xpow.cc Wed Sep 14 09:59:31 2022 -0400 @@ -132,9 +132,8 @@ // FIXME: Improve this threshold calculation. uint64_t sparsity = atmp.numel() / atmp.nnz(); // reciprocal of density - int threshold = (sparsity >= 10000) ? 40 - : (sparsity >= 1000) ? 30 - : (sparsity >= 100) ? 20 + int threshold = (sparsity >= 1000) ? 40 + : (sparsity >= 100) ? 20 : 3; if (btmp > threshold) // use squaring technique @@ -220,9 +219,8 @@ // FIXME: Improve this threshold calculation. uint64_t sparsity = atmp.numel() / atmp.nnz(); // reciprocal of density - int threshold = (sparsity >= 10000) ? 40 - : (sparsity >= 1000) ? 30 - : (sparsity >= 100) ? 20 + int threshold = (sparsity >= 1000) ? 40 + : (sparsity >= 100) ? 20 : 3; if (btmp > threshold) // use squaring technique