Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
yamiteru committed Apr 3, 2023
1 parent ac7c0e5 commit fc67027
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ const testBenchmark = defaultSuite("Test", {

## API

### `preset`
### `createPreset`

Returns a `suite` preset with predefined options.
Creates a suite preset with the provided options.

```ts
const suite = preset({
Expand Down Expand Up @@ -90,14 +90,14 @@ These are the default options:
}
```

### `suite`
### `createSuite`

Returns a function which asynchronously runs all provided benchmarks.
Creates a named suite with an object of benchmarks.

Usually you get this `suite` function from calling `preset` with options. But if you want just a suite with default options then you can import `suite` function directly from the library.

```ts
const runBenchmarks = suite("Name", {
const firstSuite = suite("Name", {
// benchmarks
});
```
Expand All @@ -110,6 +110,14 @@ await secondSuite();
await thirdSuite();
```

### `runSuite`

Collects stats for the previously defined benchmarks and triggers lifecycle events with the appropriate data.

```ts
await firstSuite();
```

### `useTerminal`

Listens to events and prints suite and benchmark results into a terminal.
Expand All @@ -126,6 +134,10 @@ await runBenchmarks();

The `suite` by itself doesn't return any data. For consuming suite and benchmarks data you should listen to events. All events are prefixed with `$`.

Behind the scenes `isitfast` uses `ueve` to create, subscribe to and publish into events.

You can easily import `sub`/`clr`/`has` event functions from `isitfast`. They're just re-exported functions from `ueve`.

- `$suiteBefore` Before suite gets run
- `$suiteOffsets` After suite offsets get calculated
- `$suiteAfter` After suite gets run
Expand Down

0 comments on commit fc67027

Please sign in to comment.