forEach vs for..of

JavaScript performance comparison

Revision 5 of this test case created by Mahdi Yari

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  const tx = {
    ref_block_num: 1234,
    ref_block_prefix: 445566,
    expiration: '2017-07-09T10:00:00.000',
    operations: [
      [
        'vote',
        {
          voter: 'foo',
          author: 'bar',
          permlink: 'i-like-b',
          weight: 10000
        }
      ]
    ],
    extensions: [],
    signatures: []
  };
  const keyWif = '5JQy7moK9SvNNDxn8rKNfQYFME5VDYC2j9Mv2tb7uXV5jz3fQR8';
  
  const dsteemKey = dsteem.PrivateKey.fromString(keyWif);
  const dsteemClient = new dsteem.Client();
  
  const transac = new steemTx.Transaction(tx);
  const txKey = steemTx.PrivateKey.fromString(keyWif);

};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
forEach
transac.sign(txKey);
pending…
for..of
dsteemClient.broadcast.sign(tx, dsteemKey);
pending…

Revisions

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

0 Comments