This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: vector lightweight debug mode


On 15/11/15 22:12 +0100, François Dumont wrote:
Here is a last version I think.

   I completed the debug light mode by adding some check on iterator
ranges.

   Even if check are light I made some changes to make sure that
internally vector is not using methods instrumented with those checks.
This is to make sure checks are not done several times. Doing so also
simplify normal mode especially when using insert range, there is no
need to check if parameters are integers or not.

Yes, I'd also observed that those improvements could be made, to avoid
dispatching when we already know we have iterators not integers.

   I also introduce some __builtin_expect to make sure compiler will
prefer the best path.

   I didn't manage to check result on generated code. I am pretty sure
there will be an impact, you can't run more code without impact. But
that is a known drawback of debug mode, light or not, we just need to
minimize it. Mostly by making sure that checks are done only once.

Not doing the checks is also an option. That minimizes the cost :-)

For the full debug mode we want to check everything we can, and accept
that has a cost.

For the lightweight one we need to evaluate the relative benefits. Is
it worth adding checks for errors that only happen rarely? Does the
benefit outweigh the cost?

I'm still not convinced that's the case for the "valid range" checks.
I'm willing to be convinced, but am not convinced yet.

   It would be great to have it for gcc 6.0. I am working on the same
for other containers.

Please don't do the valid range checks for std::deque, the checks are
undefined for iterators into different containers and will not give a
reliable answer.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]