[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to
From: |
John W. Eaton |
Subject: |
[Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors |
Date: |
Thu, 25 Jan 2024 11:42:34 -0500 (EST) |
Follow-up Comment #6, bug#65200 (group octave):
In the nil_rep changeset, what is meant by the comment "// Also increased in
octave_base_value()"? I don't see any change to the octave_base_value default
constructor.
How much does this really save? Could we achieve the same thing (avoiding the
"m_rep != nil_rep ()" test in by modifying the nil_rep function to be
octave_base_value * octave_value::nil_rep ()
{
static bool initialized = false;
static octave_base_value nr;
if (! initialized)
{
// Artificially increment count for NR so that it should never
// reach zero and NR will never be a candidate for deletion.
nr.m_count++;
initialized = true;
}
return &nr;
}
If using a separate class is better, then why is it better? If the reason is
performance, is it actually a measurable difference?
If we do decide use the class, I don't think the reinterpret_cast is needed,
or it wouldn't be if the full declaration of the octave_nil_value class were
available in ov.h and if it used public inheritance. Is there some reason the
full declaration can't be available there and a reason to use private
inheritance? Also, make the octave_value_nilrep object a static member of the
octave_nil_value class instead of a global variable.
We should also define or explicitly default or delete the common constructors,
operators, and destructor. Finally, the grammar of the comment for the
octave_nil_value class should be fixed and it would be good if the commit
message also follows the project style guidelines.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65200>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Petter, 2024/01/23
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Petter, 2024/01/23
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Petter, 2024/01/23
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Arun Giridhar, 2024/01/24
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, John W. Eaton, 2024/01/24
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Markus Mützel, 2024/01/25
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors,
John W. Eaton <=
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Petter, 2024/01/31
- [Octave-bug-tracker] [bug #65200] Special nil octave_base_value class to speed up octave_value dtors, Petter, 2024/01/31