How to use bench-trial - 4 common examples

To help you get started, we’ve selected a few bench-trial examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ViacomInc / data-point / packages / bench-trial / examples / async-example.js View on Github external
Promise.resolve(true).then(() => {
    done(null, true);
  });
}

function testSetTimeOut(done) {
  setTimeout(() => {
    done(null, true);
  }, 0);
}

module.exports = [
  {
    async: true,
    name: "promise",
    test: test(testPromise, expected),
    benchmark: testPromise
  },
  {
    async: true,
    name: "timeout",
    test: test(testSetTimeOut, expected),
    benchmark: testSetTimeOut
  }
];
github ViacomInc / data-point / packages / bench-trial / examples / array-iteration.js View on Github external
let index = 0;
  while (index !== array.length) {
    result += array[index];
    index += 1;
  }

  const length = result.length;
  result = "";
  return length;
}

module.exports = [
  {
    async: false,
    name: "while-loop",
    test: test(whileLoop, expected),
    benchmark: whileLoop
  },
  {
    async: false,
    name: "for-loop",
    test: test(forLoop, expected),
    benchmark: forLoop
  }
];
github ViacomInc / data-point / packages / bench-trial / examples / async-example.js View on Github external
setTimeout(() => {
    done(null, true);
  }, 0);
}

module.exports = [
  {
    async: true,
    name: "promise",
    test: test(testPromise, expected),
    benchmark: testPromise
  },
  {
    async: true,
    name: "timeout",
    test: test(testSetTimeOut, expected),
    benchmark: testSetTimeOut
  }
];
github ViacomInc / data-point / packages / bench-trial / examples / array-iteration.js View on Github external
const length = result.length;
  result = "";
  return length;
}

module.exports = [
  {
    async: false,
    name: "while-loop",
    test: test(whileLoop, expected),
    benchmark: whileLoop
  },
  {
    async: false,
    name: "for-loop",
    test: test(forLoop, expected),
    benchmark: forLoop
  }
];

bench-trial

Runs one or multiple benchmark tests

Apache-2.0
Latest version published 5 years ago

Package Health Score

64 / 100
Full package analysis

Popular bench-trial functions