Compare logging string addition versus commas

Benchmark created by Eric Blade on


Setup

var str1 = "The Quick Brown Fox Jumped";
    var str2 = "Over the Lazy Dog";
    var str3 = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.";
    var str4 = "Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";

Test runner

Ready to run.

Testing in
TestOps/sec
4 strings added
console.log(str1 + str2 + str3 + str4);
ready
4 strings logged as individual arguments
console.log(str1, str2, str3, str4);
ready
2 short strings added
console.log(str1 + str2);
ready
2 short strings as individual params
console.log(str1, str2);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.

  • Revision 1: published by Eric Blade on