|
|
|
|
|
by jeffbee
1465 days ago
|
|
You have accurately described the GNU CoW string :-) My impression through the fog of history is that what happened was a really clever GNU person with little foresight and no access to an SMP system implemented std::string with CoW. Its performance in practice was so poor that the standard committee intentionally changed the standard to make it an illegal implementation, thereby eradicating the GNU CoW string. There was no higher principled logic. |
|
https://blogs.msmvps.com/gdicanio/2016/07/09/is-copy-on-writ...
https://oribenshir.github.io/afternoon_rusting/blog/copy-on-...
Also, the point of that was to improve multithreading of string: I think this very idea is problematic. I've written at this point hundreds of thousands of line of C++, and the number of times where strings are really, by design, supposed to be shared across threads is honestly counted on the fingers of one hand, just like e.g. justification for using Arc over Rc in rust. 99% of string handling is done as some GUI work on the main thread or as part of some task processing done in some network thread, which stays in that thread.