octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #56752] Performance slowdown from version 3.2.


From: Rik
Subject: [Octave-bug-tracker] [bug #56752] Performance slowdown from version 3.2.4 through to current dev branch
Date: Fri, 16 Aug 2019 15:21:43 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

Follow-up Comment #23, bug #56752 (project octave):

Is this safe?


-  const octave_value& elem (octave_idx_type n) const
-  { return data(n); }
+  const octave_value& elem (octave_idx_type n) const { return data[n]; }


The ovl class is a little weird in that if you index a value outside of the
current size it automatically resizes.


  octave_value& elem (octave_idx_type n)
  {
    if (n >= length ())
      resize (n + 1);

    return m_data[n];
  }


Wouldn't a programmer expect that the const/non-const version of elem have the
same behavior?


octave_value_list ovl;

octave_value elem3 = ovl(3);  // succeeds
const octave_value elem5c = ovl(5); // exception because 5 is larger than
std::vector size??




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56752>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]