Skip to content

Commit d1dc827

Browse files
committed
cleanup
1 parent 13ef22a commit d1dc827

24 files changed

+65
-64
lines changed

webdriver-ts-results/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webdriver-ts-results/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"@types/node": "^14.14.2",
1111
"@types/react": "^16.9.53",
1212
"@types/react-dom": "^16.9.8",
13-
"jStat": "^1.8.6",
13+
"jstat": "^1.9.5",
1414
"plotly.js-cartesian-dist": "1.55.2",
1515
"react": "^17.0.1",
1616
"react-dom": "^17.0.1",

webdriver-ts-results/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { FrameworkType, knownIssues } from './Common';
44
import ResultTable from './ResultTable';
55
import { SelectionBar } from './selection/SelectionBar';
66

7-
const App = () => {
7+
const App = (): JSX.Element => {
88
// eslint-disable-next-line no-constant-condition
99
const disclaimer = (false) ? (<div>
1010
<h2>Results for js web frameworks benchmark - official run</h2>

webdriver-ts-results/src/Common.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
22
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33
// eslint-disable-next-line @typescript-eslint/no-var-requires
4-
const jStat: any = require('jStat').jStat;
4+
const jStat = require('jstat').jStat;
55

66
export enum StatisticResult {Slower, Undecided, Faster}
77
export enum DisplayMode { DisplayMean, DisplayMedian, BoxPlot }
@@ -33,15 +33,22 @@ export const categories: Category[] = [
3333
{id:5, text:"[Issue]: Errors in the implementation", issues: [634], severity: Severity.Error},
3434
]
3535

36-
export const knownIssues = [
36+
interface IIssue {
37+
issue: number,
38+
severity: Severity,
39+
text: string,
40+
link: string
41+
}
42+
43+
export const knownIssues: IIssue[] = [
3744
{issue: 634, severity: Severity.Error, text:"[Issue]: The HTML structure for the implementation is not fully correct.", link: "https://github.com/krausest/js-framework-benchmark/issues/634"},
3845
{issue: 772, severity: Severity.Note, text:"[Note]: Implementation uses manual DOM manipulations", link: "https://github.com/krausest/js-framework-benchmark/issues/772"},
3946
{issue: 796, severity: Severity.Note, text:"[Note]: Implementation uses explicit requestAnimationFrame calls", link: "https://github.com/krausest/js-framework-benchmark/issues/796"},
4047
{issue: 800, severity: Severity.Note, text:"[Note]: View state on the model", link: "https://github.com/krausest/js-framework-benchmark/issues/800"},
4148
{issue: 801, severity: Severity.Note, text:"[Note]: Implementation uses manual event delegation", link: "https://github.com/krausest/js-framework-benchmark/issues/801"},
4249
];
4350

44-
export function findIssue(issueNumber: number) {
51+
export function findIssue(issueNumber: number): IIssue|undefined {
4552
return knownIssues.find(i => i.issue === issueNumber)
4653
}
4754
export enum BenchmarkType { CPU, MEM, DUMMY, STARTUP }
@@ -245,7 +252,7 @@ export class ResultTableData {
245252
public getResult(type: BenchmarkType): ResultData {
246253
return this.resultsMap.get(type)!
247254
}
248-
sortBy(sortKey: string) {
255+
sortBy(sortKey: string): void {
249256
const zipped = this.frameworks.map((f,frameworkIndex) => {
250257
let sortValue;
251258
if (sortKey === SORT_BY_NAME) sortValue = f.name;
@@ -288,7 +295,7 @@ export class ResultTableData {
288295
return copy;
289296
}
290297

291-
computeGeometricMean(framework: Framework, benchmarksCPU: Array<Benchmark>, resultsCPUForFramework: Array<TableResultValueEntry|null>) {
298+
computeGeometricMean(framework: Framework, benchmarksCPU: Array<Benchmark>, resultsCPUForFramework: Array<TableResultValueEntry|null>): TableResultGeommeanEntry {
292299
let count = 0.0;
293300
const gMean = resultsCPUForFramework.reduce((gMean, r) => {
294301
if (r !== null) {
@@ -301,7 +308,7 @@ export class ResultTableData {
301308
return this.compareWith ? new TableResultGeommeanEntry(framework.name, framework, value, '#fff', '#000') :
302309
new TableResultGeommeanEntry(framework.name, framework, value, computeColor(value), '#000');
303310
}
304-
computeComparison(framework: Framework, benchmarksCPU: Array<Benchmark>, resultsCPUForFramework: Array<TableResultValueEntry|null>) {
311+
computeComparison(framework: Framework, benchmarksCPU: Array<Benchmark>, resultsCPUForFramework: Array<TableResultValueEntry|null>): TableResultComparisonEntry {
305312
if (this.compareWith) {
306313
let statisticResult: StatisticResult|undefined = undefined;
307314
resultsCPUForFramework.forEach((r) => {
@@ -377,12 +384,4 @@ export class ResultTableData {
377384
}
378385
});
379386
}
380-
filterResults = function(bench: Benchmark, frameworks: Array<Framework>, results: Array<Result>) {
381-
return frameworks.reduce((array, framework) => {
382-
const res = results.filter(r => r.benchmark === bench.id && r.framework === framework.name);
383-
if (res.length===1) array.push(res[0]);
384-
else array.push(null);
385-
return array;
386-
}, new Array<Result|null>());
387-
}
388387
}

webdriver-ts-results/src/ResultTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface Props {
1111
type: FrameworkType;
1212
}
1313

14-
const ResultTable = ({type}: Props) => {
14+
const ResultTable = ({type}: Props): JSX.Element|null => {
1515
const texts = {
1616
[FrameworkType.KEYED]:
1717
{label: 'Keyed results',

webdriver-ts-results/src/reducer.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { benchmarks as benchmark_orig, frameworks, results as rawResults } from
66
const benchmarks = benchmark_orig.filter(b => b.id !== '32_startup-bt');
77
// eslint-disable-next-line @typescript-eslint/no-explicit-any
88
// eslint-disable-next-line @typescript-eslint/no-var-requires
9-
const jStat: any = require('jStat').jStat;
9+
const jStat = require('jstat').jStat;
1010

1111
const results: Result[] = (rawResults as RawResult[]).map(res => Object.assign(({ framework: res.f, benchmark: res.b, values: res.v }),
1212
{
@@ -53,11 +53,11 @@ export interface State {
5353
categories: Set<number>;
5454
}
5555

56-
export const areAllBenchmarksSelected = (state: State, type: BenchmarkType) => state.benchmarkLists[type].every(b => state.selectedBenchmarks.has(b))
57-
export const isNoneBenchmarkSelected = (state: State, type: BenchmarkType) => state.benchmarkLists[type].every(b => !state.selectedBenchmarks.has(b))
56+
export const areAllBenchmarksSelected = (state: State, type: BenchmarkType): boolean => state.benchmarkLists[type].every(b => state.selectedBenchmarks.has(b))
57+
export const isNoneBenchmarkSelected = (state: State, type: BenchmarkType): boolean => state.benchmarkLists[type].every(b => !state.selectedBenchmarks.has(b))
5858

59-
export const areAllFrameworksSelected = (state: State, type: FrameworkType) => state.frameworkLists[type].every(f => state.selectedFrameworksDropDown.has(f))
60-
export const isNoneFrameworkSelected = (state: State, type: FrameworkType) => state.frameworkLists[type].every(f => !state.selectedFrameworksDropDown.has(f))
59+
export const areAllFrameworksSelected = (state: State, type: FrameworkType): boolean => state.frameworkLists[type].every(f => state.selectedFrameworksDropDown.has(f))
60+
export const isNoneFrameworkSelected = (state: State, type: FrameworkType): boolean => state.frameworkLists[type].every(f => !state.selectedFrameworksDropDown.has(f))
6161

6262

6363
let preInitialState: State = {
@@ -96,6 +96,7 @@ function updateResultTable({ frameworks, benchmarks, selectedFrameworksDropDown:
9696
}
9797
}
9898

99+
/* eslint-disable @typescript-eslint/no-explicit-any */
99100
function extractState(state: any): Partial<State> {
100101
let t = {};
101102
if (state.benchmarks!==undefined) {
@@ -207,6 +208,7 @@ export const sort = (sortKey: string): SortAction => {
207208
}
208209

209210
interface SetStateFromClipboardAction { type: 'SET_STATE_FROM_CLIPBOARD'; data: any }
211+
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
210212
export const setStateFromClipboard = (state: any): SetStateFromClipboardAction => {
211213
return { type: 'SET_STATE_FROM_CLIPBOARD', data: { state } }
212214
}
@@ -215,7 +217,6 @@ type Action = SelectFrameworkAction | SelectAllFrameworksAction | SelectBenchmar
215217
| SelectDisplayModeAction | CompareAction | StopCompareAction | SortAction
216218
| SelectCategoryAction | SelectAllCategoriesAction | SetStateFromClipboardAction;
217219

218-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
219220
export const reducer = (state = initialState, action: Action): State => {
220221
console.log("reducer", action)
221222
switch (action.type) {

webdriver-ts-results/src/results.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -379,23 +379,23 @@ export const results: RawResult[]=[
379379
{"f":"domvm-v3.4.12-keyed","b":"32_startup-bt","v":[0.12,0,0]},
380380
{"f":"domvm-v3.4.12-keyed","b":"33_startup-mainthreadcost","v":[9931.708,8.035999999999998,9.827999999999994]},
381381
{"f":"domvm-v3.4.12-keyed","b":"34_startup-totalbytes","v":[153.666015625,153.666015625,153.666015625]},
382-
{"f":"doohtml-keyed","b":"01_run1k","v":[40.759,40.852,41.021,41.107,41.228,41.229,41.324,42.191,44.102,44.328]},
383-
{"f":"doohtml-keyed","b":"02_replace1k","v":[41.744,41.893,43.114,43.115,43.411,43.582,43.961,44.55,45.225,45.482]},
382+
{"f":"doohtml-keyed","b":"01_run1k","v":[40.411,40.548,40.957,41.069,41.116,41.172,41.584,41.739,41.966,42.398]},
383+
{"f":"doohtml-keyed","b":"02_replace1k","v":[41.777,42.26,42.37,43.376,43.544,43.629,43.686,43.72,43.866,45.506]},
384384
{"f":"doohtml-keyed","b":"03_update10th1k_x16","v":[89.778,90.184,93.983,94.301,94.393,94.995,95.258,96.045,97.916,98.127]},
385385
{"f":"doohtml-keyed","b":"04_select1k","v":[11.081,11.096,11.246,12.266,12.384,12.53,12.857,12.859,13.442,13.772]},
386386
{"f":"doohtml-keyed","b":"05_swap1k","v":[23.453,24.324,24.348,24.516,24.571,24.575,24.803,24.828,24.884,25.054]},
387387
{"f":"doohtml-keyed","b":"06_remove-one-1k","v":[10.931,15.368,15.375,15.429,15.578,15.72,15.877,15.877,15.911,16.022]},
388388
{"f":"doohtml-keyed","b":"07_create10k","v":[432.761,437.969,440.635,442.232,453.127,456.862,457.303,459.817,459.993,465.295]},
389389
{"f":"doohtml-keyed","b":"08_create1k-after1k_x2","v":[94.251,94.402,94.507,94.729,94.773,94.96,95.198,96.138,96.162,96.395]},
390390
{"f":"doohtml-keyed","b":"09_clear1k_x8","v":[27.01,28.615,28.913,28.924,28.945,29.026,29.056,29.529,29.622,29.853]},
391-
{"f":"doohtml-keyed","b":"21_ready-memory","v":[1.5434904098510742]},
392-
{"f":"doohtml-keyed","b":"22_run-memory","v":[2.872197151184082]},
391+
{"f":"doohtml-keyed","b":"21_ready-memory","v":[1.3633146286010742]},
392+
{"f":"doohtml-keyed","b":"22_run-memory","v":[2.7684106826782227]},
393393
{"f":"doohtml-keyed","b":"23_update5-memory","v":[2.7496490478515625]},
394394
{"f":"doohtml-keyed","b":"25_run-clear-memory","v":[1.328592300415039]},
395395
{"f":"doohtml-keyed","b":"26_run-10k-memory","v":[14.838410377502441]},
396-
{"f":"doohtml-keyed","b":"31_startup-ci","v":[1943.116,1932.5720000000001,1879.716]},
397-
{"f":"doohtml-keyed","b":"32_startup-bt","v":[0,0,0]},
398-
{"f":"doohtml-keyed","b":"33_startup-mainthreadcost","v":[5.5559999999999965,6.075999999999998,6.063999999999997]},
396+
{"f":"doohtml-keyed","b":"31_startup-ci","v":[1920.64,1889.696,1971.228]},
397+
{"f":"doohtml-keyed","b":"32_startup-bt","v":[0.09999999999999999,0,0]},
398+
{"f":"doohtml-keyed","b":"33_startup-mainthreadcost","v":[10325.54,6.863999999999993,12.075999999999992]},
399399
{"f":"doohtml-keyed","b":"34_startup-totalbytes","v":[175.5859375,175.5859375,175.5859375]},
400400
{"f":"doz-v3.4.1-keyed","b":"01_run1k","v":[61.683,61.837,62.065,62.161,62.399,62.538,62.638,62.694,62.846,62.919]},
401401
{"f":"doz-v3.4.1-keyed","b":"02_replace1k","v":[60.655,61.463,61.639,61.774,61.949,62.015,62.347,62.5,62.984,63.086]},
@@ -2053,7 +2053,7 @@ export const results: RawResult[]=[
20532053
{"f":"valtio-v17.0.1 + 1.6.1-keyed","b":"32_startup-bt","v":[0,0,0]},
20542054
{"f":"valtio-v17.0.1 + 1.6.1-keyed","b":"33_startup-mainthreadcost","v":[7.999999999999992,7.1839999999999975,8.191999999999997]},
20552055
{"f":"valtio-v17.0.1 + 1.6.1-keyed","b":"34_startup-totalbytes","v":[277.091796875,277.091796875,277.091796875]},
2056-
{"f":"vanillajs-keyed","b":"01_run1k","v":[37.515,37.723,37.766,37.812,37.916,38.397,38.452,38.892,38.936,38.984]},
2056+
{"f":"vanillajs-keyed","b":"01_run1k","v":[37.678,37.713,37.827,37.847,37.891,37.942,37.981,38.005,38.323,38.344]},
20572057
{"f":"vanillajs-keyed","b":"02_replace1k","v":[39.497,39.545,40.356,40.405,40.413,40.668,40.939,40.993,41.138,41.265]},
20582058
{"f":"vanillajs-keyed","b":"03_update10th1k_x16","v":[85.291,86.186,87.402,88.134,88.869,88.917,90.57,91.441,92.84,95.804]},
20592059
{"f":"vanillajs-keyed","b":"04_select1k","v":[6.553,7.045,7.454,8.422,8.561,8.758,8.97,9.139,9.771,10.519]},

webdriver-ts-results/src/selection/CopyPasteSelection.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import * as React from 'react';
22
import { useDispatch, useSelector } from 'react-redux';
3-
import { categories} from '../Common';
4-
import { selectAllCategories, selectCategory, setStateFromClipboard, State } from '../reducer';
5-
import DropDown from './DropDown';
6-
import { DropDownContents } from './DropDownContents';
3+
import { categories } from '../Common';
4+
import { setStateFromClipboard, State } from '../reducer';
75

8-
const CopyPasteSelection = () =>
6+
const CopyPasteSelection = (): JSX.Element =>
97
{
108
console.log("CopyPasteSelection");
119
const dispatch = useDispatch();

webdriver-ts-results/src/selection/DropDown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ interface Props {
66
width: string;
77
}
88

9-
const DropDown = ({label, children, width}: Props) => {
9+
const DropDown = ({label, children, width}: Props): JSX.Element => {
1010
const [open, setOpen] = useState(false);
1111
const toggle = useCallback((event: React.SyntheticEvent<HTMLElement>) => {
1212
event.stopPropagation();
1313
setOpen(!open)
1414
}, [open])
15-
const click = (event: React.SyntheticEvent<HTMLElement>) => {
15+
const click = () => {
1616
// There's a pretty strange corner case: Click on which frameworks and deselect all keyed
1717
// frameworks. Then select one keyed framework. This will cause scrolling such that the
1818
// which frameworks drop down will be scrolled out of the visible area.

webdriver-ts-results/src/selection/DropDownContents.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22

3-
interface Props<T> {
3+
interface Props {
44
children: Array<JSX.Element>;
55
selectNone: (event: React.SyntheticEvent) => void;
66
selectAll: (event: React.SyntheticEvent) => void;
@@ -9,7 +9,7 @@ interface Props<T> {
99
grid?: boolean;
1010
}
1111

12-
export function DropDownContents<T>(props: Props<T>) {
12+
export function DropDownContents(props: Props): JSX.Element {
1313
const {selectNone, selectAll, isNoneSelected, areAllSelected, children, grid = false} = props;
1414
return <div className="section">
1515
{children[0]}

0 commit comments

Comments
 (0)