Skip to content

Instantly share code, notes, and snippets.

@isaaclyman
Created January 11, 2019 21:53
Show Gist options
  • Save isaaclyman/352bf9aac5fd4cf0019fb4498ccbf850 to your computer and use it in GitHub Desktop.
Save isaaclyman/352bf9aac5fd4cf0019fb4498ccbf850 to your computer and use it in GitHub Desktop.

Revisions

  1. isaaclyman created this gist Jan 11, 2019.
    15 changes: 15 additions & 0 deletions testSpeed.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    function testSpeed() {
    const stack = [];

    function assignValue(index) {
    stack[index] = 'bob ' + index;
    }

    const t0 = performance.now()
    for (let ix = 0; ix < 15000; ix++) {
    assignValue(ix);
    }
    const t1 = performance.now()

    return [stack, t1 - t0];
    }