[profile-stdlib] PATCH: Add three diagnostics and implement cost factor parameterization

Silvius Rus rus@google.com
Mon Dec 7 22:15:00 GMT 2009

On Sun, Dec 6, 2009 at 7:38 PM, Changhee Jung <haemil99@gmail.com> wrote:
> Hello libstdc++ maintainers,

Hello maintainers,

Can this still make it to 4.5, given that it affects only the profile
mode?  If so, could you review it as a patch to trunk instead of
branch?  There are no other changes on the profile-stdlib branch since
the last merge to trunk, except for very minor fixes.

Thank you,

> The attached patch implements the following in the profile-stdlib branch:
> 1) New diagnostics
>  - list-to-vector; if data is inserted at the end of the list and
> iteration operation is common, vector is better.
>  - list-to-slist; slist is more likely to fit in a cache line due to
> less memory usage.
>  - list-to-set; if a find operation, 'std::find', is frequently used
> in the list, set is better.
> 2) Cost factor parameterization; constant factors of the cost models
> for diagnostics can be read from a file, "libstdcxx-profile.conf" or
> environment variables.
> There is an issue related to thel instrumentation of 'std::find'.
> It seems that 'bits/stl_algo.h' was modified for the parallel mode so
> that its functions declared in the namespace of '_GLIBCXX_STD_P' can
> be used instead of original functions in the release mode.
> Currently, I did the same thing, conditional compilation stuff, to
> hide the original 'find' function under its wrapper function.
> This inevitably causes a modification to the original 'bits/stl_algo.h'.
> Alternatively, it is possible to duplicate the 'bits/stl_algo.h' in
> 'profile/stl_algo.h' and modify the copy to avoid any intrusion from
> the profile mode to the release mode.
> It would be appreciated if you come up with a better idea to deal with this.
> Thank you,
> Changhee

More information about the Libstdc++ mailing list