changeset 24018:df53ba41ea90

For performance, don't initialize SparseRep data array to 0. * Sparse.h (SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = 0)): Don't use aggregate initialization of array d. It is not necessary since valid elements are controlled by r and c indices and will be set when an actual value is assigned.
author Rik <rik@octave.org>
date Wed, 06 Sep 2017 15:00:51 -0700
parents b0e696ea6487
children fc4ba8b1ff87
files liboctave/array/Sparse.h
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/liboctave/array/Sparse.h	Wed Sep 06 16:39:41 2017 -0400
+++ b/liboctave/array/Sparse.h	Wed Sep 06 15:00:51 2017 -0700
@@ -78,7 +78,7 @@
     { }
 
     SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = 0)
-      : d (nz > 0 ? new T [nz] {} : nullptr),
+      : d (nz > 0 ? new T [nz] : nullptr),
         r (nz > 0 ? new octave_idx_type [nz] {} : nullptr),
         c (new octave_idx_type [nc+1] {}), nzmx (nz), nrows (nr),
         ncols (nc), count (1)