Appendix B. Test Results for Single-Threaded versus Multithread-Safe String Implementations
This appendix contains supplementary details for Item 16 and Appendix A. The test harness source code can be downloaded via a link on this book's Web page at http://www.gotw.ca/publications/mxc++.htm, if you'd like to try it on your system.
To assess COW, I performed measurements of three kinds of functions:
Copying (where COW shines, its raison d'être)
Mutating operations that could trigger reallocation (represented by
Append(), which gradually lengthens; this is to make sure any conclusions drawn can take into account periodic reallocation overhead due to normal string use)
Possibly-mutating operations that do not change length enough to trigger reallocation, ...