Skip to content

Commit

Permalink
Create performance-entries.test.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Jan 1, 2025
1 parent cc1de2b commit 4042d63
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/js/web/timers/performance-entries.test.ts
Original file line number Diff line number Diff line change
@@ -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);
});

0 comments on commit 4042d63

Please sign in to comment.