Skip to content

Commit 676a8fa

Browse files
committed
fix boxplot
1 parent 13f2777 commit 676a8fa

File tree

9 files changed

+17
-16
lines changed

9 files changed

+17
-16
lines changed

Diff for: webdriver-ts-results/.eslintignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
webpack.config.js
2-
.eslintrc.js
2+
.eslintrc.js
3+
src/results.ts

Diff for: webdriver-ts-results/src/Common.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export class ResultTableData {
349349

350350
computeFactors(benchmark: Benchmark): Array<TableResultValueEntry|null> {
351351

352-
let resultsKey = benchmark.type == BenchmarkType.CPU ? this.cpuDurationMode : DEFAULT_RESULTS_KEY;
352+
const resultsKey = benchmark.type == BenchmarkType.CPU ? this.cpuDurationMode : DEFAULT_RESULTS_KEY;
353353

354354
const benchmarkResults = this.frameworksForFactors.map(f => this.results(benchmark, f));
355355
const selectFn = (result: Result|null) => {

Diff for: webdriver-ts-results/src/reducer.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ const benchmarks = benchmark_orig.filter(b => b.id !== '32_startup-bt'
1010
const jStat = require('jstat').jStat;
1111

1212
const results: Result[] = (rawResults as RawResult[]).map(res => {
13-
let values: {[k: string]: ResultValues} = {};
14-
for (let key of Object.keys(res.v)) {
15-
let r = res.v[key];
16-
let vals = {
13+
const values: {[k: string]: ResultValues} = {};
14+
for (const key of Object.keys(res.v)) {
15+
const r = res.v[key];
16+
const vals = {
1717
mean: r ? jStat.mean(r) : Number.NaN,
1818
median: r ? jStat.median(r) : Number.NaN,
1919
standardDeviation: r ? jStat.stdev(r, true) : Number.NaN,
@@ -133,7 +133,7 @@ function extractState(state: any): Partial<State> {
133133
}
134134
if (state.categories!==undefined) {
135135
const newSelectedCategories = new Set<number>();
136-
for (const f of state?.categories) {
136+
for (const f of state?.categories ?? []) {
137137
for (const sc of categories) {
138138
if (f === sc.id) newSelectedCategories.add(sc.id);
139139
}

Diff for: webdriver-ts-results/src/tables/BoxPlotTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const BoxPlot = ({traces}: {traces: Array<BoxPlotData>}): JSX.Element =>
3737
}
3838

3939
const RenderBoxPlotsRow = ({frameworks, benchmark, results, currentSortKey, sortBy, cpuDurationMode}: {frameworks: Array<Framework>; benchmark: Benchmark; results: ResultLookup; currentSortKey: string; sortBy: (name: string) => void, cpuDurationMode: CpuDurationMode}) => {
40-
let resultsValues = (framework: Framework) => results(benchmark, framework)?.results[cpuDurationMode] ?? [];
40+
const resultsValues = (framework: Framework) => results(benchmark, framework)?.results[cpuDurationMode].values ?? [];
4141
return <tr key={benchmark.id} style={{height: 400}}>
4242
<th className='benchname'><button className={currentSortKey===benchmark.id ? 'sortKey textButton' : 'textButton'}
4343
onClick={(event) => {event.preventDefault(); sortBy(benchmark.id)}}>{benchmark.label}</button>
@@ -51,7 +51,7 @@ const RenderBoxPlotsRow = ({frameworks, benchmark, results, currentSortKey, sort
5151

5252
const RenderBoxPlotsRows = ({frameworks, benchmarks, results, currentSortKey, sortBy, cpuDurationMode}: {frameworks: Array<Framework>; benchmarks: Array<Benchmark>; results: ResultLookup; currentSortKey: string; sortBy: (name: string) => void, cpuDurationMode: CpuDurationMode}) => {
5353
return <>{benchmarks.map((benchmark) =>
54-
<RenderBoxPlotsRow frameworks={frameworks} benchmark={benchmark} results={results} currentSortKey={currentSortKey} sortBy={sortBy} cpuDurationMode={cpuDurationMode}/>
54+
<RenderBoxPlotsRow key={benchmark.id} frameworks={frameworks} benchmark={benchmark} results={results} currentSortKey={currentSortKey} sortBy={sortBy} cpuDurationMode={cpuDurationMode}/>
5555
)}</>
5656
}
5757
// {data.frameworks.map(f => <th key={f.name}>{f.name}</th>)}

Diff for: webdriver-ts-results/src/tables/CompareRow.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const CompareRow = ({comparison, compareWith}: {comparison: Array<TableResultCom
99
if (!compareWith) {
1010
return (<tr>
1111
<th>compare: Green means significantly faster, red significantly slower</th>
12-
{comparison.map(result => result == null ? <th></th> :
12+
{comparison.map((result,idx) => result == null ? <th key={idx}></th> :
1313
<th key={result.key} style={{backgroundColor:result.bgColor, color:result.textColor}}>
1414
<button className={'sortKey textButton'} onClick={() => dispatch(compare(result.framework))}>compare</button>
1515
</th>
@@ -19,7 +19,7 @@ const CompareRow = ({comparison, compareWith}: {comparison: Array<TableResultCom
1919
return (
2020
<tr>
2121
<th>compare: Green means significantly faster, red significantly slower</th>
22-
{comparison.map(result => result == null ? <th></th> :
22+
{comparison.map((result,idx) => result == null ? <th key={idx}></th> :
2323
<th key={result.key} style={{backgroundColor:result.bgColor, color:result.textColor}}>
2424
{result.label}
2525
{ (compareWith === result.framework) ? <button className={'sortKey textButton'} onClick={() => dispatch(stopCompare(result.framework))}>stop compare</button>

Diff for: webdriver-ts-results/src/tables/CpuResultsTable.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const CpuResultsTable = ({data, currentSortKey, sortBy}: {data: ResultTableData;
1616
<tr>
1717
<th className='benchname'><button className={currentSortKey===SORT_BY_NAME ? 'sortKey textButton' : 'textButton'} onClick={(event) => {event.preventDefault(); sortBy(SORT_BY_NAME)}}>Name</button><br/>Duration for...</th>
1818
{data.frameworks.map((f,idx) => <th key={idx}>{
19-
f.frameworkHomeURL ? <a target="_blank" href={f.frameworkHomeURL}>{f.displayname}</a> : f.displayname
19+
f.frameworkHomeURL ? <a target="_blank" rel="noreferrer" href={f.frameworkHomeURL}>{f.displayname}</a> : f.displayname
2020
}
2121
</th>)}
2222
</tr>
@@ -37,7 +37,7 @@ const CpuResultsTable = ({data, currentSortKey, sortBy}: {data: ResultTableData;
3737
<th>Implementation link</th>
3838
{data.frameworks.map(f =>
3939
<th key={f.name} >
40-
<a target="_blank" href={"https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/"+f.dir}>code</a>
40+
<a target="_blank" rel="noreferrer" href={"https://github.com/krausest/js-framework-benchmark/tree/master/frameworks/"+f.dir}>code</a>
4141
</th>)}
4242
</tr>
4343
</thead>

Diff for: webdriver-ts-results/src/tables/GeomMeanRow.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const GeomMeanRow = ({geomMean, currentSortKey, sortBy, sortbyGeommeanEnum}: {ge
1010
return (
1111
<tr>
1212
<th><button className={currentSortKey === sortbyGeommeanEnum ? 'sortKey textButton' : 'textButton'} onClick={sort(sortbyGeommeanEnum)}>geometric mean</button>of all factors in the table</th>
13-
{geomMean.map(result => result == null ? <th></th> :
13+
{geomMean.map((result,idx) => result == null ? <th key={idx}></th> :
1414
<th key={result.key} style={{backgroundColor:result.bgColor, color:result.textColor}}>{result.mean.toFixed(2)}
1515
</th>
1616
)}

Diff for: webdriver-ts-results/src/tables/ValueResultRow.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const ValueResultRow = ({benchIdx, resultsForBenchmark, benchmarks, currentSortK
1919
<div className="rowCount">{benchmarks[benchIdx].description}</div>
2020
</th>
2121
{resultsForBenchmark && resultsForBenchmark.map((result,idx) => result == null ? <td key={idx}></td> :
22-
<ValueCell {...result}/>)}
22+
<ValueCell {...result} key={result.key}/>)}
2323
</tr>
2424
};
2525

Diff for: webdriver-ts-results/table.html

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)