react-native-benchmark

React Native benchmarking library inspired by benchmark.js and written in TypeScript.

Installation

npm i -s benchmark-ts

Usage

// example/index.ts
import { EventType, Suite } from "../src";

const suite = new Suite;

suite.add('RegExp#test', () => {
  /o/.test('Hello World!');
})
.add('String#indexOf', () => {
  'Hello World!'.indexOf('o') > -1;
})
.add('String#match', () => {
  !!'Hello World!'.match(/o/);
})
.on(EventType.CYCLE, (event) => {
  // console.log(event.type, event.target.times);
})
.on(EventType.COMPLETE, (event) => {
  // const s:Suite = event.target as Suite
  console.log(suite.toString())
})
.run({async: true});

GitHub

https://github.com/eugenehp/react-native-benchmark