Skip to content

Document how to retrieve results #4

@ecstrema

Description

@ecstrema

Add a working example in readme

The current example does the test, but doesn't log nor output anything to a file. Trying it was very deceiving, although after some research, the lib seems great!

Original issue

Reproduction:

// test.js
import { Bench } from "tinybench";

const bench = new Bench({ time: 100 });

bench
  .add("Test tinybench", () => {
    let a = 8;
    let b = 1;
    const c = a;
    a = b;
    b = c;
  });

console.log(await bench.run());
node test,js

Output:

[ m {} ]

Expected output:

Benchmark results?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions