From e6e87d27697c025f2489aa6a80012960b6ed7774 Mon Sep 17 00:00:00 2001 From: Michael Dellanoce Date: Mon, 11 Sep 2023 09:28:37 -0400 Subject: [PATCH] add benchmark for addList worst case performance --- .../rrweb/test/benchmark/dom-mutation.test.ts | 6 ++++ .../benchmark-dom-mutation-add-reorder.html | 33 +++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/rrweb/test/html/benchmark-dom-mutation-add-reorder.html diff --git a/packages/rrweb/test/benchmark/dom-mutation.test.ts b/packages/rrweb/test/benchmark/dom-mutation.test.ts index 3da794db45..73ddf4e1c2 100644 --- a/packages/rrweb/test/benchmark/dom-mutation.test.ts +++ b/packages/rrweb/test/benchmark/dom-mutation.test.ts @@ -42,6 +42,12 @@ const suites: Array< eval: 'window.workload()', times: 5, }, + { + title: 'add and reorder 10000 DOM nodes', + html: 'benchmark-dom-mutation-add-reorder.html', + eval: 'window.workload()', + times: 5, + }, ]; function avg(v: number[]): number { diff --git a/packages/rrweb/test/html/benchmark-dom-mutation-add-reorder.html b/packages/rrweb/test/html/benchmark-dom-mutation-add-reorder.html new file mode 100644 index 0000000000..c4b7d24d11 --- /dev/null +++ b/packages/rrweb/test/html/benchmark-dom-mutation-add-reorder.html @@ -0,0 +1,33 @@ + + + + + +