Eric Roman
2010-07-16 22:31:48 UTC
[C++ / STL question]
Does Chromium have any fixed expectations on whether the underlying
std::string implementations will be reference counted and
copy-on-write ?
The reason I ask, is I have a use case where I am sharing a (possibly
large) immutable string16 between several places.
Currently I am using copy-construction. It works out OK as the
underlying bytes end up being shared.
But certainly if this implementation detail doesn't hold, that code
will have an undesirable memory footprint.
Are there any compiler gurus here that know how reliable this
implementation detail is across platforms, chrome's build settings,
and the future?
If I can't rely on this, then I will need to consider other solutions
like having a reference-counted wrapper for the string types I want to
share
(but this feels ugly and overkill if we know our strings will always
be reference counted).
In fact, my general impression is that non-COW string implementations
will hurt Chrome performance, as we rely heavily on string copying
(for example inside containers, and when PostTask-ing |const
std::string&| between threads, etc.)
Thanks!
Does Chromium have any fixed expectations on whether the underlying
std::string implementations will be reference counted and
copy-on-write ?
The reason I ask, is I have a use case where I am sharing a (possibly
large) immutable string16 between several places.
Currently I am using copy-construction. It works out OK as the
underlying bytes end up being shared.
But certainly if this implementation detail doesn't hold, that code
will have an undesirable memory footprint.
Are there any compiler gurus here that know how reliable this
implementation detail is across platforms, chrome's build settings,
and the future?
If I can't rely on this, then I will need to consider other solutions
like having a reference-counted wrapper for the string types I want to
share
(but this feels ugly and overkill if we know our strings will always
be reference counted).
In fact, my general impression is that non-COW string implementations
will hurt Chrome performance, as we rely heavily on string copying
(for example inside containers, and when PostTask-ing |const
std::string&| between threads, etc.)
Thanks!
--
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Chromium Developers mailing list: chromium-***@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev