Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions packages/state-transition/test/perf/misc/proxy.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
import {bench, describe} from "@chainsafe/benchmark";

/**
* V8 Proxy-overhead reference microbenchmark. Kept for ad-hoc evaluation only — these are
* tight 100K-iteration hot loops with no per-iteration work besides the property read, so
* results are dominated by V8 inline-cache and engine-version effects and have very high
* run-to-run variance on the shared CI runner (e.g. `arrayWithProxy get 100000 times`
* tripped a 3.73x alert on PR #9494 with no Lodestar code change touching this path).
*
* No `src/` code uses `new Proxy(...)` so this isn't tracking a real regression surface;
* skip in CI to stop generating false-positive alerts on unrelated PRs. Switch to
* `bench(...)` locally if you want to take a measurement.
*/
describe("Proxy cost", () => {
const n = 100_000;
const array: number[] = [];
Expand All @@ -23,15 +34,15 @@ describe("Proxy cost", () => {
},
};

bench(`regular array get ${n} times`, () => {
bench.skip(`regular array get ${n} times`, () => {
for (let i = 0; i < n; i++) array[i];
});

bench(`wrappedArray get ${n} times`, () => {
bench.skip(`wrappedArray get ${n} times`, () => {
for (let i = 0; i < n; i++) wrappedArray.get(i);
});

bench(`arrayWithProxy get ${n} times`, () => {
bench.skip(`arrayWithProxy get ${n} times`, () => {
for (let i = 0; i < n; i++) arrayWithProxy[i];
});
});
Loading