exponential string multiplication (v2)

Revision 2 of this benchmark created on


Preparation HTML

<script>
  // iteration
  
  function stringMultiply1(string, n) {
   var x = Math.floor(Math.log(n) / Math.log(2)),
       temp = string;
   for (var i = 0; i < x; i++)
   string += string;
   return (n) ? string + stringMultiply1(temp, n - Math.pow(2, x)) : "";
  }
</script>

Test runner

Ready to run.

Testing in
TestOps/sec
1000000
stringMultiply1("hello ", 1000000)
ready
10000000
 
ready
100000000
stringMultiply1("hello ", 100000000)
ready
1000000000
stringMultiply1("hello ", 1000000000)
ready
1000000000
stringMultiply1("hello ", 10000000000)
ready
100000000000
stringMultiply1("hello ", 100000000000)
ready

Revisions

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