changeset 31227:0dec459a4064

sparse-xpow.cc: Performance tweak for threshold selection
author Arun Giridhar <arungiridhar@gmail.com>
date Wed, 14 Sep 2022 09:59:31 -0400
parents 44cf6bbeeca9
children 4c1be4d6d0d1
files libinterp/corefcn/sparse-xpow.cc
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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