diff --git a/test/js/web/timers/performance-entries.test.ts b/test/js/web/timers/performance-entries.test.ts new file mode 100644 index 00000000000000..bfc297cc1a84ce --- /dev/null +++ b/test/js/web/timers/performance-entries.test.ts @@ -0,0 +1,17 @@ +import { expect, test } from "bun:test"; +import { estimateShallowMemoryUsageOf } from "bun:jsc"; + +test("memory usage of Performance", () => { + const initial = estimateShallowMemoryUsageOf(performance); + for (let i = 0; i < 1024; i++) { + performance.mark(`mark-${i}`); + } + const final = estimateShallowMemoryUsageOf(performance); + + for (let i = 1; i < 1024; i++) { + performance.measure(`measure-${i}`, `mark-${i}`, `mark-${i - 1}`); + } + const final2 = estimateShallowMemoryUsageOf(performance); + expect(final2).toBeGreaterThan(final); + expect(final).toBeGreaterThan(initial); +});