Skip to content

Commit 57006db

Browse files
committed
code splitting for results
1 parent 5207e2c commit 57006db

File tree

8 files changed

+156
-67
lines changed

8 files changed

+156
-67
lines changed

push_results.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/usr/bin/cp webdriver-ts-results/table.html ../krausest.github.io/js-framework-benchmark/current.html
2+
/usr/bin/cp webdriver-ts-results/BoxPlotTable*.js ../krausest.github.io/js-framework-benchmark/
3+
cd ../krausest.github.io
4+
git add js-framework-benchmark/current.html
5+
git add js-framework-benchmark/BoxPlotTable*.js
6+
git commit -m "update results"
7+
git push
8+
cd ../js-framework-benchmark/webdriver-ts

webdriver-ts-results/BoxPlotTable.3dbc5f31bbc56578e4f0.js

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

webdriver-ts-results/package-lock.json

Lines changed: 108 additions & 11 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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
"react-dom": "^16.13.1",
1717
"react-redux": "^7.2.1",
1818
"react-scripts": "3.4.3",
19-
"redux": "^4.0.5",
20-
"typescript": "^3.7.5"
19+
"redux": "^4.0.5"
2120
},
2221
"scripts": {
2322
"start": "react-scripts start",
2423
"build": "react-scripts build",
2524
"test": "react-scripts test",
2625
"eject": "react-scripts eject",
2726
"lint": "eslint './src/**/*.{ts,tsx}'",
28-
"build-prod": "cross-env NODE_ENV=\"production\" webpack -c webpack.config.js && cpx dist/table.html ."
27+
"build-prod": "rimraf dist && cross-env NODE_ENV=\"production\" webpack --env prod -c webpack.config.js && rimraf table.html && rimraf \"BoxPlotTable*.js\" && cpx dist/table.html . && cpx \"dist/BoxPlotTable*.js\" ."
2928
},
3029
"eslintConfig": {
3130
"extends": "react-app"
@@ -49,7 +48,9 @@
4948
"eslint-plugin-react-hooks": "^4.1.2",
5049
"html-webpack-plugin": "^4.5.0",
5150
"inline-chunk-html-plugin": "^1.1.1",
51+
"rimraf": "^3.0.2",
5252
"ts-loader": "^8.0.5",
53+
"typescript": "^4.0.3",
5354
"webpack-bundle-analyzer": "^3.9.0",
5455
"webpack-cli": "^4.0.0"
5556
}

webdriver-ts-results/src/ResultTable.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
22
import {ResultTableData, DisplayMode, BenchmarkType, FrameworkType} from './Common';
33
import CpuResultsTable from './tables/CpuResultsTable'
4-
import BoxPlotTable from './tables/BoxPlotTable'
54
import MemResultsTable from './tables/MemResultsTable'
65
import StartupResultsTable from './tables/StartupResultsTable'
76
import { useDispatch, useSelector } from 'react-redux';
87
import { sort, State } from './reducer';
8+
const BoxPlotTable = React.lazy(() => import(/* webpackChunkName: "BoxPlotTable" */ './tables/BoxPlotTable'));
99

1010
interface Props {
1111
type: FrameworkType;
@@ -35,9 +35,11 @@ const ResultTable = ({type}: Props) => {
3535
<p>{texts[type].description}</p>
3636
{
3737
displayMode === DisplayMode.BoxPlot ?
38-
(<>
39-
<BoxPlotTable results={data.results} frameworks={data.frameworks} benchmarks={data.getResult(BenchmarkType.CPU).benchmarks} currentSortKey={currentSortKey} sortBy={sortBy}/>
40-
</>)
38+
(
39+
<React.Suspense fallback={<div>Loading...</div>}>
40+
<BoxPlotTable results={data.results} frameworks={data.frameworks} benchmarks={data.getResult(BenchmarkType.CPU).benchmarks} currentSortKey={currentSortKey} sortBy={sortBy}/>
41+
</React.Suspense>
42+
)
4143
:
4244
(<>
4345
<CpuResultsTable currentSortKey={currentSortKey} sortBy={sortBy} data={data}/>

0 commit comments

Comments
 (0)