Skip to content

Commit 0f2c4d2

Browse files
authored
Update React to 16.8 and add new "deeptree" benchmark (#17)
* Use React 16.8 alpha * Make ReactDOM an external for app builds * Use React 16.8 final + profiling build * Capture render profiling values * Add initial deeptree benchmark * Add RSK * Build out deeptree benchmark
1 parent aa03a74 commit 0f2c4d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+13972
-237
lines changed

copy-to-public/react-dom.production.min.js

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

copy-to-public/react.production.min.js

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

runBenchmarks.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ async function runBenchmarks() {
8181
const fpsValuesWithoutFirst = fpsValues.slice(1);
8282
const lastEntry = _.last(fpsValues);
8383

84-
const averageFPS = fpsValuesWithoutFirst.reduce((sum, entry) => sum + entry.FPS, 0) / fpsValuesWithoutFirst.length || 0;
84+
const averageFPS = fpsValuesWithoutFirst.reduce((sum, entry) => sum + entry.FPS, 0) / fpsValuesWithoutFirst.length || 1;
8585

8686
const pairwiseEntries = pairwise(fpsValuesWithoutFirst);
8787

@@ -107,7 +107,16 @@ async function runBenchmarks() {
107107

108108
const fps = {averageFPS, weightedFPS, values : fpsValuesWithoutFirst}
109109

110-
versionPerfEntries[version] = {fps, profile : {categories}};
110+
111+
const {reactTimingEntries} = fpsRunResults;
112+
113+
const [mountEntry, ...updateEntries] = reactTimingEntries;
114+
115+
const mountTime = mountEntry.actualTime;
116+
117+
const averageUpdateTime = updateEntries.reduce((sum, entry) => sum + entry.actualTime, 0) / updateEntries.length || 1;
118+
119+
versionPerfEntries[version] = {fps, profile : {categories}, mountTime, averageUpdateTime};
111120

112121
server.close();
113122
} catch (e) {
@@ -127,13 +136,13 @@ async function runBenchmarks() {
127136
}
128137

129138
const table = new Table({
130-
head: ['Version', 'Avg FPS', ...traceCategories, 'FPS Values']
139+
head: ['Version', 'Avg FPS', "Render\n(Mount, Avg)", ...traceCategories, 'FPS Values']
131140
});
132141

133142
Object.keys(versionPerfEntries).sort().forEach(version => {
134143
const versionResults = versionPerfEntries[version];
135144

136-
const {fps, profile} = versionResults;
145+
const {fps, profile, mountTime, averageUpdateTime,} = versionResults;
137146

138147
let traceResults = [];
139148

@@ -150,6 +159,7 @@ async function runBenchmarks() {
150159
table.push([
151160
version,
152161
fps.weightedFPS.toFixed(2),
162+
`${mountTime.toFixed(1)}, ${averageUpdateTime.toFixed(1)}`,
153163
...traceResults,
154164
fpsNumbers.toString()
155165
])

sources/deeptree/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# See https://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
6+
# testing
7+
/coverage
8+
9+
# production
10+
/build
11+
12+
# misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

sources/deeptree/README.md

Lines changed: 2486 additions & 0 deletions
Large diffs are not rendered by default.

sources/deeptree/config-overrides.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = function override(config, env) {
2+
//do stuff with the webpack config...
3+
console.log(`Environment: ${env}`)
4+
5+
if(env === "production") {
6+
config.externals = {
7+
"react" : "React",
8+
"redux" : "Redux",
9+
"react-dom" : "ReactDOM",
10+
"react-redux" : "ReactRedux",
11+
}
12+
}
13+
14+
15+
return config;
16+
}

sources/deeptree/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "deeptree",
3+
"version": "0.1.0",
4+
"private": true,
5+
"dependencies": {
6+
"chance": "^1.0.16",
7+
"fps-emit": "file:../../fps-emit",
8+
"react": "^16.6.0",
9+
"react-dom": "^16.6.0",
10+
"react-redux": "^5.1.0",
11+
"react-scripts": "2.0.3",
12+
"redux": "^4.0.0",
13+
"redux-starter-kit": "^0.4.3",
14+
"reselect": "^3.0.1"
15+
},
16+
"scripts": {
17+
"start": "react-app-rewired start",
18+
"build": "react-app-rewired build",
19+
"test": "react-app-rewired --env=jsdom",
20+
"eject": "react-scripts eject",
21+
"test:e2e": "jest --watch"
22+
},
23+
"browserslist": {
24+
"development": [
25+
"last 2 chrome versions",
26+
"last 2 firefox versions",
27+
"last 2 edge versions"
28+
],
29+
"production": [
30+
">0.25%",
31+
"not op_mini all",
32+
"ie 11"
33+
]
34+
},
35+
"devDependencies": {
36+
"react-app-rewired": "^1.5.2"
37+
}
38+
}

sources/deeptree/public/bootstrap.min.css

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

sources/deeptree/public/favicon.ico

3.78 KB
Binary file not shown.

sources/deeptree/public/index.html

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
6+
<meta name="theme-color" content="#000000">
7+
<!--
8+
manifest.json provides metadata used when your web app is added to the
9+
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
10+
-->
11+
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
12+
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
13+
<link href="static/css/bootstrap.min.css" rel="stylesheet">
14+
<!--
15+
Notice the use of %PUBLIC_URL% in the tags above.
16+
It will be replaced with the URL of the `public` folder during the build.
17+
Only files inside the `public` folder can be referenced from the HTML.
18+
19+
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
20+
work correctly both with client-side routing and a non-root public URL.
21+
Learn how to configure a non-root public URL by running `npm run build`.
22+
-->
23+
<title>React App</title>
24+
25+
26+
</head>
27+
<body>
28+
<noscript>
29+
You need to enable JavaScript to run this app.
30+
</noscript>
31+
<div class="container" id="root"></div>
32+
<!--
33+
This HTML file is a template.
34+
If you open it directly in the browser, you will see an empty page.
35+
36+
You can add webfonts, meta tags, or analytics to this file.
37+
The build step will place the bundled scripts into the <body> tag.
38+
39+
To begin the development, run `npm start` or `yarn start`.
40+
To create a production bundle, use `npm run build` or `yarn build`.
41+
-->
42+
43+
44+
<script type="text/javascript" src="redux.min.js"></script>
45+
<script type="text/javascript" src="react.production.min.js"></script>
46+
<script type="text/javascript" src="react-dom.production.min.js"></script>
47+
<script type="text/javascript" src="react-redux.min.js"></script>
48+
</body>
49+
</html>

sources/deeptree/public/manifest.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"short_name": "React App",
3+
"name": "Create React App Sample",
4+
"icons": [
5+
{
6+
"src": "favicon.ico",
7+
"sizes": "64x64 32x32 24x24 16x16",
8+
"type": "image/x-icon"
9+
}
10+
],
11+
"start_url": ".",
12+
"display": "standalone",
13+
"theme_color": "#000000",
14+
"background_color": "#ffffff"
15+
}

sources/deeptree/public/static/css/bootstrap.min.css

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

0 commit comments

Comments
 (0)