mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
28 lines
568 B
JavaScript
28 lines
568 B
JavaScript
import { expect } from "bun:test";
|
|
import { bench, run } from "../runner.mjs";
|
|
|
|
const MAP_SIZE = 10_000;
|
|
|
|
function* genPairs(count) {
|
|
for (let i = 0; i < MAP_SIZE; i++) {
|
|
yield ["k" + i, "v" + i];
|
|
}
|
|
}
|
|
|
|
class CustomMap extends Map {
|
|
abc = 123;
|
|
constructor(iterable) {
|
|
super(iterable);
|
|
}
|
|
}
|
|
|
|
const a = new Map(genPairs());
|
|
const b = new Map(genPairs());
|
|
bench("deepEqual Map", () => expect(a).toEqual(b));
|
|
|
|
const x = new CustomMap(genPairs());
|
|
const y = new CustomMap(genPairs());
|
|
bench("deepEqual CustomMap", () => expect(x).toEqual(y));
|
|
|
|
await run();
|