[Top][All Lists]

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

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

From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #56752] Performance slowdown from version 3.2.4 through to current dev branch
Date: Fri, 13 Sep 2019 15:21:31 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0

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

Rik: when you write

const Array<int> new_ra (old_ra);
int elt = new_ra(1);

then you call the const elem method which doesn't need to check the reference
count because it can't modify the array.

But if you write

Array<int> new_ra (old_ra);
int elt = new_ra(1);

then the non-const elem method is called.  It returns a reference and is not
(and could not, at the time these classes were first written) be overloaded
based on whether it it is used in an rvalue or lvalue context, so it has to
check the reference count and maybe force a copy to provide COW semantics.

Now, with modern C++, is it possible to determine whether the operator is
invoked in an lvalue or rvalue context?  If so, then we could just fix this
with some changes to the Array class.  But even after reading about
ref-qualifiers and looking at some examples, I don't see how to do it.


Reply to this item at:


  Message sent via Savannah

reply via email to

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