Immutable C++ String class
Design

In modern standard libraries, std::string uses short string optimization, which allows to avoid heap allocations at all for string shorter then ~20 chars (on 64-bit machines). So you really want to measure performance, I am not readily convinced that your string offers performance improvement. Of course, for your specific use pattern it might, but you have to measure.

__dup function

This is the most problematic part of the code.


Apparently, you forgot to return value from __dup method (now fixed).
You must allocate one char more and fill it with zero. Or copy size+1 characters from the source.
Identifiers with leading double underscores or one leading underscore and a capital letter are reserved by the standard. You must not use such an identifier. It is enough that you already have put it into private section.


After the corrections, the function could look like this:

static char *dup(const char *s){
    auto size = strlen(s);
    char *copy = new char[size + 1];
    memcpy(copy, s, size + 1);
    return copy;
}


Safety

Functions do not check for null pointers. This code will cause illegal memory access:

String x;
String y{x};


Style


You don't need semicolons after the member function definitions
I would recommend not putting methods on a single line even if they have empty bodies.
You can use C++ style headers &lt;cstring&gt; and &lt;cstdio&gt; instead of C-style ones.
I would recommend to implement an operator&lt;&lt;(std::ostream &amp;, const String &amp;) so you could use your string together with iostreams.
For testing, it is better to use a testing framework. Like boost.test, gtest, Catch etc.