var str1="hello";
var str2="world";
var str3;
var start = new Date().getTime();
for (i = 0; i < 100000; ++i) {
str3=str1+str2;
}
var end = new Date().getTime();
var time = end - start;
print('Execution time using + operator: ' + time);
// USING CONCAT OPERATOR
start = new Date().getTime();
for (i = 0; i < 100000; ++i) {
str3=str1.concat(str2);
}
end = new Date().getTime();
time = end - start;
print('Execution time using CONCAT operator: ' + time);
CXZhciBzdHIxPSJoZWxsbyI7Cgl2YXIgc3RyMj0id29ybGQiOwoJdmFyIHN0cjM7Cgl2YXIgc3RhcnQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKCWZvciAoaSA9IDA7IGkgPCAxMDAwMDA7ICsraSkgewoJc3RyMz1zdHIxK3N0cjI7Cgl9Cgl2YXIgZW5kID0gbmV3IERhdGUoKS5nZXRUaW1lKCk7Cgl2YXIgdGltZSA9IGVuZCAtIHN0YXJ0OwoKCXByaW50KCdFeGVjdXRpb24gdGltZSB1c2luZyArIG9wZXJhdG9yOiAnICsgdGltZSk7CgoJLy8gVVNJTkcgQ09OQ0FUIE9QRVJBVE9SCgoJc3RhcnQgPSBuZXcgRGF0ZSgpLmdldFRpbWUoKTsKCWZvciAoaSA9IDA7IGkgPCAxMDAwMDA7ICsraSkgewoJc3RyMz1zdHIxLmNvbmNhdChzdHIyKTsKCX0KCWVuZCA9IG5ldyBEYXRlKCkuZ2V0VGltZSgpOwoJdGltZSA9IGVuZCAtIHN0YXJ0OwoJcHJpbnQoJ0V4ZWN1dGlvbiB0aW1lIHVzaW5nIENPTkNBVCBvcGVyYXRvcjogJyArIHRpbWUpOw==