Skip to content

Commit 7164351

Browse files
committed
Merge branch 'main' into improve-derived-ownerhsip
2 parents e075adb + 974e823 commit 7164351

File tree

1 file changed

+54
-27
lines changed

1 file changed

+54
-27
lines changed

benchmarking/benchmarks/sbench.js

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,12 @@ export async function sbench_create_0to1() {
174174
}
175175

176176
const { timing } = await fastest_test(10, () => {
177-
for (let i = 0; i < 100; i++) {
178-
bench(create_computations_0to1, COUNT, 0);
179-
}
177+
const destroy = $.effect_root(() => {
178+
for (let i = 0; i < 10; i++) {
179+
bench(create_computations_0to1, COUNT, 0);
180+
}
181+
});
182+
destroy();
180183
});
181184

182185
return {
@@ -193,9 +196,12 @@ export async function sbench_create_1to1() {
193196
}
194197

195198
const { timing } = await fastest_test(10, () => {
196-
for (let i = 0; i < 100; i++) {
197-
bench(create_computations_1to1, COUNT, COUNT);
198-
}
199+
const destroy = $.effect_root(() => {
200+
for (let i = 0; i < 10; i++) {
201+
bench(create_computations_1to1, COUNT, COUNT);
202+
}
203+
});
204+
destroy();
199205
});
200206

201207
return {
@@ -212,9 +218,12 @@ export async function sbench_create_2to1() {
212218
}
213219

214220
const { timing } = await fastest_test(10, () => {
215-
for (let i = 0; i < 100; i++) {
216-
bench(create_computations_2to1, COUNT / 2, COUNT);
217-
}
221+
const destroy = $.effect_root(() => {
222+
for (let i = 0; i < 10; i++) {
223+
bench(create_computations_2to1, COUNT / 2, COUNT);
224+
}
225+
});
226+
destroy();
218227
});
219228

220229
return {
@@ -231,9 +240,12 @@ export async function sbench_create_4to1() {
231240
}
232241

233242
const { timing } = await fastest_test(10, () => {
234-
for (let i = 0; i < 100; i++) {
235-
bench(create_computations_4to1, COUNT / 4, COUNT);
236-
}
243+
const destroy = $.effect_root(() => {
244+
for (let i = 0; i < 10; i++) {
245+
bench(create_computations_4to1, COUNT / 4, COUNT);
246+
}
247+
});
248+
destroy();
237249
});
238250

239251
return {
@@ -250,9 +262,12 @@ export async function sbench_create_1000to1() {
250262
}
251263

252264
const { timing } = await fastest_test(10, () => {
253-
for (let i = 0; i < 100; i++) {
254-
bench(create_computations_1000to1, COUNT / 1000, COUNT);
255-
}
265+
const destroy = $.effect_root(() => {
266+
for (let i = 0; i < 10; i++) {
267+
bench(create_computations_1000to1, COUNT / 1000, COUNT);
268+
}
269+
});
270+
destroy();
256271
});
257272

258273
return {
@@ -269,9 +284,12 @@ export async function sbench_create_1to2() {
269284
}
270285

271286
const { timing } = await fastest_test(10, () => {
272-
for (let i = 0; i < 100; i++) {
273-
bench(create_computations_1to2, COUNT, COUNT / 2);
274-
}
287+
const destroy = $.effect_root(() => {
288+
for (let i = 0; i < 10; i++) {
289+
bench(create_computations_1to2, COUNT, COUNT / 2);
290+
}
291+
});
292+
destroy();
275293
});
276294

277295
return {
@@ -288,9 +306,12 @@ export async function sbench_create_1to4() {
288306
}
289307

290308
const { timing } = await fastest_test(10, () => {
291-
for (let i = 0; i < 100; i++) {
292-
bench(create_computations_1to4, COUNT, COUNT / 4);
293-
}
309+
const destroy = $.effect_root(() => {
310+
for (let i = 0; i < 10; i++) {
311+
bench(create_computations_1to4, COUNT, COUNT / 4);
312+
}
313+
});
314+
destroy();
294315
});
295316

296317
return {
@@ -307,9 +328,12 @@ export async function sbench_create_1to8() {
307328
}
308329

309330
const { timing } = await fastest_test(10, () => {
310-
for (let i = 0; i < 100; i++) {
311-
bench(create_computations_1to8, COUNT, COUNT / 8);
312-
}
331+
const destroy = $.effect_root(() => {
332+
for (let i = 0; i < 10; i++) {
333+
bench(create_computations_1to8, COUNT, COUNT / 8);
334+
}
335+
});
336+
destroy();
313337
});
314338

315339
return {
@@ -326,9 +350,12 @@ export async function sbench_create_1to1000() {
326350
}
327351

328352
const { timing } = await fastest_test(10, () => {
329-
for (let i = 0; i < 100; i++) {
330-
bench(create_computations_1to1000, COUNT, COUNT / 1000);
331-
}
353+
const destroy = $.effect_root(() => {
354+
for (let i = 0; i < 10; i++) {
355+
bench(create_computations_1to1000, COUNT, COUNT / 1000);
356+
}
357+
});
358+
destroy();
332359
});
333360

334361
return {

0 commit comments

Comments
 (0)