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: debug mode performance patch


Hi,

and first thanks a lot for working hard on this! In general I'm in favor
of applying the patch or a variant of it pretty soon, but let's give
other interested parties a chance to comment, say until the end of the week.
>   This is a patch to improve libstdc++ performance and also limit
> contention when used in debug mode.
>
>   I finally prefered to use a simple approach which is to always
> synchronize access to the lists of safe iterators. I considered that
> trying to make hypothesis on the operation validity in a multithreaded
> environment was error prone because you might do such operations on
> unrelated parts of the sequence which will work in normal mode but not
> with the safe one because of the modifications of safe iterators
> lists. The _M_prior/_M_next safe iterator fields are considered to be
> part of the sequence lists and only safe sequence methods are
> modifying them now. Safe iterator _M_get_mutex is not used anymore but
> is kept for binary compatibility.
>
>   I introduce usage of lambda expressions in forward_list
> implementation rather than introducing new functor like _Equal_to and
> others. I hope that as it is a C++0x container it is fine to use
> lambdas in its implementation.
Sure.
>   To reduce to its minimum the additional contention introduce by the
> debug mode the last modification to achieve would be to add a mutex
> instance to each safe sequence. But as it would break binary
> compatibility I simply changed _M_get_mutex_base function in debug.cc
> to handle a pool of mutexes that are associated to safe sequences
> depending on their memory address. Just tell me if you know a better
> technique to associate a safe sequence instance with a mutex one from
> the pool.
This morning I wondered if we could learn something from this work,
which we have been able to apply without breaking the binary compatibility:

    http://gcc.gnu.org/ml/libstdc++/2007-06/msg00017.html

(see also the ensuing exchanges until the final commit in October,
2007). Maybe Jakub is willing to have a look too, I'm adding him in CC.

As a minor nit, I see some unuglified names, like transfered_iterators.

Thanks,
Paolo.


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