fork(2) download
  1. var str1="hello";
  2. var str2="world";
  3. var str3;
  4. var start = new Date().getTime();
  5. for (i = 0; i < 100000; ++i) {
  6. str3=str1+str2;
  7. }
  8. var end = new Date().getTime();
  9. var time = end - start;
  10.  
  11. print('Execution time using + operator: ' + time);
  12.  
  13. // USING CONCAT OPERATOR
  14.  
  15. start = new Date().getTime();
  16. for (i = 0; i < 100000; ++i) {
  17. str3=str1.concat(str2);
  18. }
  19. end = new Date().getTime();
  20. time = end - start;
  21. print('Execution time using CONCAT operator: ' + time);
Success #stdin #stdout 0.03s 30272KB
stdin
Standard input is empty
stdout
Execution time using + operator: 2
Execution time using CONCAT operator: 10