From c70a6e6b152e4a0d9def229219a9b2e927e84985 Mon Sep 17 00:00:00 2001 From: Aiden Bai Date: Tue, 5 Oct 2021 17:43:19 -0700 Subject: [PATCH] refactor(benchmarks): organize imports --- benchmarks/benchmark.mjs | 2 +- benchmarks/main.jsx | 51 ++++++++----------- .../suites/appendManyRowsToLargeTable.jsx | 2 +- benchmarks/suites/clearRows.jsx | 2 +- benchmarks/suites/createManyRows.jsx | 2 +- benchmarks/suites/createRows.jsx | 2 +- benchmarks/suites/partialUpdate.jsx | 2 +- benchmarks/suites/removeRow.jsx | 2 +- benchmarks/suites/replaceAllRows.jsx | 2 +- benchmarks/suites/swapRows.jsx | 2 +- 10 files changed, 30 insertions(+), 39 deletions(-) diff --git a/benchmarks/benchmark.mjs b/benchmarks/benchmark.mjs index d3fbee5b8f..a5ab417341 100644 --- a/benchmarks/benchmark.mjs +++ b/benchmarks/benchmark.mjs @@ -1,5 +1,5 @@ -import _ from 'lodash'; import Benchmark from 'benchmark'; +import _ from 'lodash'; // avoid `Cannot read property 'parentNode' of undefined` error in runScript const script = document.createElement('script'); diff --git a/benchmarks/main.jsx b/benchmarks/main.jsx index d1a2def15e..6b3afdb3c1 100644 --- a/benchmarks/main.jsx +++ b/benchmarks/main.jsx @@ -1,7 +1,5 @@ import 'style.css'; - -import { m, createElement, style, kebab, patch } from '../src/index'; - +import { createElement, patch } from '../src/index'; import appendManyRowsToLargeTable from './suites/appendManyRowsToLargeTable'; import clearRows from './suites/clearRows'; import createManyRows from './suites/createManyRows'; @@ -39,6 +37,19 @@ const suites = [ }), ); +const generateLogMarkdown = () => + `Benchmarks compiled on \`${new Date().toLocaleString()}\`\n\n**UA:** ${ + navigator.userAgent + }\n\n---\n\n${[...logs] + .map((logGroup) => { + const logGroupCopy = [...logGroup]; + const title = logGroupCopy.shift(); + return `${title.replace('Running: ', '').split(' - ')[0]}\n\n\`\`\`\n${logGroupCopy.join( + '\n', + )}\n\`\`\`\n`; + }) + .join('\n')}`; + const vnode = () => (
{suites.map((suite) => { @@ -72,19 +83,7 @@ const vnode = () => ( {' '} {' '}