If you used GCC's std::string before GCC 5.0, you might have used a different optimization called Copy-On-Write (COW). The COW string implementation, when it had multiple instances created with the same underlying character array, was actually sharing the same memory address for it. When the string was written to, the underlying storage was copied — hence the name.
This technique helped save memory and keep the caches hot, and often offered solid performance on a single thread. Beware of using it in multi-threaded contexts, though. The need for using locks can be a real performance killer. As with any performance-related topic, it's best to just measure whether in your case it's the best tool for the job.
Let's now discuss a feature of C++17 that can help you achieve good performance with dynamic allocations.