Skip to content

Commit 47ba9b1

Browse files
authored
Bench: Run edit benches before the mutation-heavy suite (#214)
1 parent b568cae commit 47ba9b1

1 file changed

Lines changed: 37 additions & 33 deletions

File tree

packages/component/bench/tachometer/bench-todo.js

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,43 @@ async function markEveryNth(el, n) {
189189
flushWork();
190190
}
191191

192+
/*******************************
193+
Edit Flow
194+
*******************************/
195+
196+
// Positioned ahead of the mutation-heavy benches (toggle/remove/filter) so the
197+
// edit path is measured against fresh component state, not the heap and
198+
// V8-feedback state those benches accumulate across the run.
199+
200+
// edit-start-10: 10 consecutive edit transitions cycling different ids
201+
// (editingId must change each iter or the signal equality short-circuits).
202+
const el14 = await setup(100);
203+
// purpose: Enters edit mode on 10 different items in a row, like double-clicking each one.
204+
performance.mark(startMark('edit-start-10'));
205+
for (let i = 0; i < 10; i++) {
206+
el14.component.editTodo(getTodos(el14)[40 + i].id);
207+
flushWork();
208+
}
209+
performance.measure('edit-start-10', startMark('edit-start-10'));
210+
destroy();
211+
212+
// edit-cycle-5: 5 full edit+save cycles (10 ops + 10 RAFs total). Fresh
213+
// mount so the first iter sees editingId=null, not the residual from
214+
// edit-start-10's last iter — otherwise that first transition is an
215+
// edit→edit hop, which is a different workload than the others.
216+
const el15 = await setup(100);
217+
// purpose: Runs 5 full edit-then-save cycles on different items, like editing a row and saving it.
218+
performance.mark(startMark('edit-cycle-5'));
219+
for (let i = 0; i < 5; i++) {
220+
const id = getTodos(el15)[40 + i].id;
221+
el15.component.editTodo(id);
222+
flushWork();
223+
el15.component.saveTodo(id, `Updated item ${i}`);
224+
flushWork();
225+
}
226+
performance.measure('edit-cycle-5', startMark('edit-cycle-5'));
227+
destroy();
228+
192229
/*******************************
193230
Bulk Creation
194231
(programmatic data load)
@@ -410,39 +447,6 @@ for (let i = 0; i < 20; i++) {
410447
performance.measure('filter-cycle-20', startMark('filter-cycle-20'));
411448
destroy();
412449

413-
/*******************************
414-
Edit Flow
415-
*******************************/
416-
417-
// edit-start-10: 10 consecutive edit transitions cycling different ids
418-
// (editingId must change each iter or the signal equality short-circuits).
419-
const el14 = await setup(100);
420-
// purpose: Enters edit mode on 10 different items in a row, like double-clicking each one.
421-
performance.mark(startMark('edit-start-10'));
422-
for (let i = 0; i < 10; i++) {
423-
el14.component.editTodo(getTodos(el14)[40 + i].id);
424-
flushWork();
425-
}
426-
performance.measure('edit-start-10', startMark('edit-start-10'));
427-
destroy();
428-
429-
// edit-cycle-5: 5 full edit+save cycles (10 ops + 10 RAFs total). Fresh
430-
// mount so the first iter sees editingId=null, not the residual from
431-
// edit-start-10's last iter — otherwise that first transition is an
432-
// edit→edit hop, which is a different workload than the others.
433-
const el15 = await setup(100);
434-
// purpose: Runs 5 full edit-then-save cycles on different items, like editing a row and saving it.
435-
performance.mark(startMark('edit-cycle-5'));
436-
for (let i = 0; i < 5; i++) {
437-
const id = getTodos(el15)[40 + i].id;
438-
el15.component.editTodo(id);
439-
flushWork();
440-
el15.component.saveTodo(id, `Updated item ${i}`);
441-
flushWork();
442-
}
443-
performance.measure('edit-cycle-5', startMark('edit-cycle-5'));
444-
destroy();
445-
446450
/*******************************
447451
Rename Flow
448452
(single-field setProperty)

0 commit comments

Comments
 (0)