Copy-on-write for DataContainers
DataContainers, having copies is expensive. Therefore, a Copy-on-Write (CoW) mechanism can reduce the number of copies to a minimum. This refers to the resource-management technique that only creates copies when the underlying data is actually changed.
As an example, the C++98 standard allowed CoW for
std::string x("Hello"); std::string y = x; // x and y use the same buffer y += ", World!"; // now y uses a different buffer // x still uses the same old buffer
- Reading up on CoW implementations for string, the argument that multi-threading performance is negatively affected by CoW came up often. Is this an issue for us?
- @lasser: I noted down in our meeting that this is especially important when setting up the optimization problem, but I can't recall the details anymore. Do you have a hint?