toString vs automatic converstion

Benchmark created by Sammy Knudsen on


Setup

var num1=11111111, num2=22222222, num3=33333333;

Test runner

Ready to run.

Testing in
TestOps/sec
toString
var numStr = num1.toString();
ready
automatic conversion prepend
var numStr = "" + num1;
ready
automatic conversion append
var numStr = num1 + "";
ready
toString multi
var numStr = num1.toString() + num2.toString() + num2.toString();
ready
automatic conversion prepend multi
var numStr = "" + num1 + num2 + num3;
ready
automatic conversion appen multi
var numStr = num1 + "" +  num2 + "" + num3;
ready

Revisions

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

  • Revision 1: published by Sammy Knudsen on