import { bench, env } from "measure-loop"; import reporter from "measure-loop/reporter"; import { allocateUnsafe } from "../src/index.ts"; import { Buffer } from "node:buffer"; await bench() .it("Buffer.allocUnsafe(0)", [], () => Buffer.allocUnsafe(0)) .it("allocateUnsafe(0)", [], () => allocateUnsafe(0)) .run({ env, reporter }); await bench() .it("Buffer.allocUnsafe(100)", [], () => Buffer.allocUnsafe(0)) .it("allocateUnsafe(100)", [], () => allocateUnsafe(0)) .run({ env, reporter }); await bench() .it("Buffer.allocUnsafe(1000)", [], () => Buffer.allocUnsafe(0)) .it("allocateUnsafe(1000)", [], () => allocateUnsafe(0)) .run({ env, reporter }); await bench() .it("Buffer.allocUnsafe(10000)", [], () => Buffer.allocUnsafe(0)) .it("allocateUnsafe(10000)", [], () => allocateUnsafe(0)) .run({ env, reporter });