#include <iostream>
#include <string>
#include <cstring>
const int size = 100000000;
static char s_str[size];
int main()
{
memset(s_str, 'x', size - 1);
std::string s(s_str);
clock_t c1, c2, c3, c4;
// =
c1 = clock();
for (int i = 0; i < 10; i++) {
s = s_str;
}
c2 = clock();
// = std::string
c3 = clock();
for (int i = 0; i < 10; i++) {
s = std::string(s_str);
}
c4 = clock();
printf("= : %d\n", static_cast<int>(c2 - c1));
printf("= std::string : %d\n", static_cast<int>(c4 - c3));
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8Y3N0cmluZz4KIApjb25zdCBpbnQgc2l6ZSA9IDEwMDAwMDAwMDsKIApzdGF0aWMgY2hhciBzX3N0cltzaXplXTsKIAppbnQgbWFpbigpCnsKICAgIG1lbXNldChzX3N0ciwgJ3gnLCBzaXplIC0gMSk7CiAKICAgIHN0ZDo6c3RyaW5nIHMoc19zdHIpOwogICAgY2xvY2tfdCBjMSwgYzIsIGMzLCBjNDsKIAogICAgLy8gPQogICAgYzEgPSBjbG9jaygpOwogICAgZm9yIChpbnQgaSA9IDA7IGkgPCAxMDsgaSsrKSB7CiAgICAgICAgcyA9IHNfc3RyOwogICAgfQogICAgYzIgPSBjbG9jaygpOwogCiAgICAvLyA9IHN0ZDo6c3RyaW5nCiAgICBjMyA9IGNsb2NrKCk7CiAgICBmb3IgKGludCBpID0gMDsgaSA8IDEwOyBpKyspIHsKICAgICAgICBzID0gc3RkOjpzdHJpbmcoc19zdHIpOwogICAgfQogICAgYzQgPSBjbG9jaygpOwogCiAgICBwcmludGYoIj0gICAgICAgICAgICAgOiAlZFxuIiwgc3RhdGljX2Nhc3Q8aW50PihjMiAtIGMxKSk7CiAgICBwcmludGYoIj0gc3RkOjpzdHJpbmcgOiAlZFxuIiwgc3RhdGljX2Nhc3Q8aW50PihjNCAtIGMzKSk7Cn0=