Skip to content

Commit cc27b88

Browse files
committed
test: keep the 50k wrappers pinned while their benchmark is timed
1 parent 938ea9d commit cc27b88

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎test-app/app/src/main/assets/app/tests/benchmarks/jniBenchmarks.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,13 @@ function buildBenchmarks() {
298298
if (FILTER && "instance.self() [50k live wrappers]".indexOf(FILTER) < 0) return null;
299299
var live = new Array(50000);
300300
for (var i = 0; i < live.length; i++) live[i] = new java.lang.Object();
301+
// Pinned from a global: an optimized frame may drop a local after its last use.
302+
globalThis.__jniBenchLive = live;
301303
var result = measureJs("instance.self() [50k live wrappers]", 50000, function (n) {
302304
var s;
303305
for (var i = 0; i < n; i++) s = bench.self();
304306
return s;
305307
});
306-
globalThis.__jniBenchLive = live;
307308
globalThis.__jniBenchLive = null;
308309
return result;
309310
},

0 commit comments

Comments
 (0)