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