diff libinterp/corefcn/pr-output.cc @ 32598:2f3b54f81947

avoid dim_vector copies in more places where possible (bug #64962) Where possible, use const reference to capture temporary dim_vector objects instead of making copies. Affected files: variable-editor-model.cc, besselj.cc, bitfcns.cc, cellfun.cc, data.cc, ellipj.cc, filter.cc, find.cc, gl-render.cc, graphics.cc, graphics.in.h, jsondecode.cc, jsonencode.cc, ls-mat5.cc, matrix_type.cc, mex.cc, oct-map.cc, pr-output.cc, sub2ind.cc, tril.cc, xpow.cc, ov-base-diag.cc, ov-base-int.cc, ov-base-mat.cc, ov-base-sparse.cc, ov-bool-mat.cc, ov-bool-sparse.cc, ov-cell.cc, ov-class.cc, ov-class.h, ov-classdef.cc, ov-cx-mat.cc, ov-cx-sparse.cc, ov-flt-cx-mat.cc, ov-flt-re-mat.cc, ov-intx.h, ov-java.cc, ov-perm.cc, ov-re-mat.cc, ov-re-sparse.cc, ov-str-mat.cc, ov-struct.cc, ovl.cc, op-int.h, op-str-str.cc, op-struct.cc, pt-eval.cc, pt-tm-const.cc, Array-base.cc, Array-util.cc, CNDArray.cc, CSparse.cc, Sparse.cc, dNDArray.cc, dSparse.cc, fCNDArray.cc, fNDArray.cc, bsxfun-defs.cc, lo-specfun.cc, mx-inlines.cc, oct-binmap.h.
author John W. Eaton <jwe@octave.org>
date Wed, 13 Dec 2023 15:48:06 -0500
parents 05b4479c29d8
children ae4e19c0a2b1
line wrap: on
line diff
--- a/libinterp/corefcn/pr-output.cc	Wed Dec 13 19:58:48 2023 +0100
+++ b/libinterp/corefcn/pr-output.cc	Wed Dec 13 15:48:06 2023 -0500
@@ -2124,7 +2124,7 @@
 
       int ndims = nda.ndims ();
 
-      dim_vector dims = nda.dims ();
+      const dim_vector& dims = nda.dims ();
 
       Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);
 
@@ -2712,7 +2712,7 @@
     {
       int ndims = nda.ndims ();
 
-      dim_vector dims = nda.dims ();
+      const dim_vector& dims = nda.dims ();
 
       Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);
 
@@ -2954,7 +2954,7 @@
 
       Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);
 
-      dim_vector dims = nda.dims ();
+      const dim_vector& dims = nda.dims ();
 
       octave_idx_type m = 1;
 
@@ -3023,7 +3023,7 @@
     {
       int ndims = nda.ndims ();
 
-      dim_vector dims = nda.dims ();
+      const dim_vector& dims = nda.dims ();
 
       Array<octave_idx_type> ra_idx (dim_vector (ndims, 1), 0);