diff --git a/.gitignore b/.gitignore
index 69f0ee3..6fed664 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,4 +32,11 @@ _site
**/avet-client/lib
**/avet-utils/lib
-*.lerna_backup
\ No newline at end of file
+*.lerna_backup
+
+asset-prod
+bench/**/build
+bench/**/.isomorphic
+
+.next
+.stats.json
\ No newline at end of file
diff --git a/bench/avet-big/README.md b/bench/avet-big/README.md
new file mode 100644
index 0000000..cc374aa
--- /dev/null
+++ b/bench/avet-big/README.md
@@ -0,0 +1,21 @@
+```bash
+[Sat Dec 16 2017 20:37:56 GMT+0800 (CST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Target URL: http://127.0.0.1:3000
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Max requests: 50
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Concurrency level: 10
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Agent: none
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Completed requests: 50
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Total errors: 0
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Total time: 2.511741034 s
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Requests per second: 20
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Mean latency: 459.7 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO Percentage of the requests served within a certain time
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO 50% 477 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO 90% 564 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO 95% 564 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO 99% 565 ms
+[Sat Dec 16 2017 20:37:59 GMT+0800 (CST)] INFO 100% 565 ms (longest request)
+```
diff --git a/bench/avet-big/package.json b/bench/avet-big/package.json
new file mode 100644
index 0000000..0b0af54
--- /dev/null
+++ b/bench/avet-big/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "bench-avet-big",
+ "version": "1.0.0-15",
+ "scripts": {
+ "start": "avet-bin build && avet-bin start"
+ },
+ "devDependencies": {
+ "avet": "1.0.0-15",
+ "avet-bin": "1.0.0-15"
+ }
+}
diff --git a/bench/avet-big/page/index.js b/bench/avet-big/page/index.js
new file mode 100644
index 0000000..43f3e29
--- /dev/null
+++ b/bench/avet-big/page/index.js
@@ -0,0 +1,13 @@
+import React from 'react';
+
+export default () => {
+ return
;
+};
+
+const items = () => {
+ const out = new Array(10000);
+ for (let i = 0; i < out.length; i++) {
+ out[i] = This is row {i + 1};
+ }
+ return out;
+};
diff --git a/bench/avet-simple/README.md b/bench/avet-simple/README.md
new file mode 100644
index 0000000..1afa8f7
--- /dev/null
+++ b/bench/avet-simple/README.md
@@ -0,0 +1,21 @@
+```bash
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Target URL: http://127.0.0.1:3000
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Max requests: 50
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Concurrency level: 10
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Agent: none
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Completed requests: 50
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Total errors: 0
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Total time: 0.104411828 s
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Requests per second: 479
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Mean latency: 17.9 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO Percentage of the requests served within a certain time
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO 50% 18 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO 90% 22 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO 95% 23 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO 99% 24 ms
+[Sat Dec 16 2017 20:45:49 GMT+0800 (CST)] INFO 100% 24 ms (longest request)
+```
diff --git a/bench/avet-simple/package.json b/bench/avet-simple/package.json
new file mode 100644
index 0000000..dc6b08a
--- /dev/null
+++ b/bench/avet-simple/package.json
@@ -0,0 +1,11 @@
+{
+ "name": "bench-avet",
+ "version": "1.0.0-15",
+ "scripts": {
+ "start": "avet-bin build && avet-bin start"
+ },
+ "devDependencies": {
+ "avet": "1.0.0-15",
+ "avet-bin": "1.0.0-15"
+ }
+}
diff --git a/bench/avet-simple/page/index.js b/bench/avet-simple/page/index.js
new file mode 100644
index 0000000..16f426b
--- /dev/null
+++ b/bench/avet-simple/page/index.js
@@ -0,0 +1 @@
+export default () => My component!
\ No newline at end of file
diff --git a/bench/beidou-big/.babelrc b/bench/beidou-big/.babelrc
new file mode 100644
index 0000000..dc45176
--- /dev/null
+++ b/bench/beidou-big/.babelrc
@@ -0,0 +1,3 @@
+{
+ "presets": ["beidou-server"]
+}
diff --git a/bench/beidou-big/bin/server.js b/bench/beidou-big/bin/server.js
new file mode 100644
index 0000000..7b4cf80
--- /dev/null
+++ b/bench/beidou-big/bin/server.js
@@ -0,0 +1,10 @@
+'use strict'; // eslint-disable-line
+const path = require('path');
+
+const beidou = require('beidou-core');
+
+beidou.startCluster({
+ port: 3000,
+ baseDir: path.join(__dirname, '..'),
+ workers: 1,
+});
diff --git a/bench/beidou-big/client/index.jsx b/bench/beidou-big/client/index.jsx
new file mode 100644
index 0000000..30e58e0
--- /dev/null
+++ b/bench/beidou-big/client/index.jsx
@@ -0,0 +1,17 @@
+import React from 'react';
+
+export default class View extends React.Component {
+ static doctype = '';
+
+ render() {
+ return ;
+ }
+}
+
+const items = () => {
+ const out = new Array(10000);
+ for (let i = 0; i < out.length; i++) {
+ out[i] = This is row {i + 1};
+ }
+ return out;
+};
diff --git a/bench/beidou-big/config/config.default.js b/bench/beidou-big/config/config.default.js
new file mode 100644
index 0000000..6c21019
--- /dev/null
+++ b/bench/beidou-big/config/config.default.js
@@ -0,0 +1,11 @@
+module.exports = {
+ keys: 'secrets',
+ isomorphic: {
+ universal: {
+ assets: [ '.css' ],
+ },
+ },
+ react: {
+ assetPath: '/public/',
+ },
+};
diff --git a/bench/beidou-big/config/config.local.js b/bench/beidou-big/config/config.local.js
new file mode 100644
index 0000000..6fbf1e2
--- /dev/null
+++ b/bench/beidou-big/config/config.local.js
@@ -0,0 +1,8 @@
+module.exports = function() {
+ const exports = {
+ react: {
+ assetPath: '/build/',
+ },
+ };
+ return exports;
+};
diff --git a/bench/beidou-big/package.json b/bench/beidou-big/package.json
new file mode 100644
index 0000000..bf91132
--- /dev/null
+++ b/bench/beidou-big/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "bench-beidou-big",
+ "version": "0.3.3",
+ "scripts": {
+ "start": "beidou-build && node ./bin/server.js"
+ },
+ "author": "",
+ "devDependencies": {
+ "babel-eslint": "^7.1.1",
+ "babel-loader": "^7.1.1",
+ "css-loader": "~0.23.1",
+ "eslint": "^4.11.0",
+ "eslint-config-beidou": "^1.0.0",
+ "extract-text-webpack-plugin": "^3.0.2",
+ "globby": "^6.1.0",
+ "husky": "^0.13.4",
+ "react-hot-loader": "^3.1.3",
+ "style-loader": "^0.19.0",
+ "webpack-hot-middleware": "^2.21.0"
+ },
+ "dependencies": {
+ "babel-preset-beidou-client": "^0.1.0",
+ "babel-preset-beidou-server": "^0.1.0",
+ "beidou-core": "^0.3.3",
+ "react": "^16.0.0",
+ "react-dom": "^16.0.0"
+ },
+ "engines": {
+ "node": ">= 6.0.0"
+ },
+ "license": "MIT"
+}
diff --git a/bench/beidou-simple/README.md b/bench/beidou-simple/README.md
new file mode 100644
index 0000000..7938446
--- /dev/null
+++ b/bench/beidou-simple/README.md
@@ -0,0 +1,21 @@
+```bash
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Target URL: http://127.0.0.1:3000
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Max requests: 50
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Concurrency level: 10
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Agent: none
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Completed requests: 50
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Total errors: 0
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Total time: 0.465302078 s
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Requests per second: 107
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Mean latency: 84.6 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO Percentage of the requests served within a certain time
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO 50% 91 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO 90% 97 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO 95% 98 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO 99% 99 ms
+[Sat Dec 16 2017 20:40:44 GMT+0800 (CST)] INFO 100% 99 ms (longest request)
+```
diff --git a/bench/beidou-simple/bin/server.js b/bench/beidou-simple/bin/server.js
new file mode 100644
index 0000000..7b4cf80
--- /dev/null
+++ b/bench/beidou-simple/bin/server.js
@@ -0,0 +1,10 @@
+'use strict'; // eslint-disable-line
+const path = require('path');
+
+const beidou = require('beidou-core');
+
+beidou.startCluster({
+ port: 3000,
+ baseDir: path.join(__dirname, '..'),
+ workers: 1,
+});
diff --git a/bench/beidou-simple/client/index.jsx b/bench/beidou-simple/client/index.jsx
new file mode 100644
index 0000000..88bf276
--- /dev/null
+++ b/bench/beidou-simple/client/index.jsx
@@ -0,0 +1,9 @@
+import React from 'react';
+
+export default class View extends React.Component {
+ static doctype = '';
+
+ render() {
+ return My component!
;
+ }
+}
diff --git a/bench/beidou-simple/config/config.default.js b/bench/beidou-simple/config/config.default.js
new file mode 100644
index 0000000..6c21019
--- /dev/null
+++ b/bench/beidou-simple/config/config.default.js
@@ -0,0 +1,11 @@
+module.exports = {
+ keys: 'secrets',
+ isomorphic: {
+ universal: {
+ assets: [ '.css' ],
+ },
+ },
+ react: {
+ assetPath: '/public/',
+ },
+};
diff --git a/bench/beidou-simple/config/config.local.js b/bench/beidou-simple/config/config.local.js
new file mode 100644
index 0000000..6fbf1e2
--- /dev/null
+++ b/bench/beidou-simple/config/config.local.js
@@ -0,0 +1,8 @@
+module.exports = function() {
+ const exports = {
+ react: {
+ assetPath: '/build/',
+ },
+ };
+ return exports;
+};
diff --git a/bench/beidou-simple/package.json b/bench/beidou-simple/package.json
new file mode 100644
index 0000000..bf91132
--- /dev/null
+++ b/bench/beidou-simple/package.json
@@ -0,0 +1,32 @@
+{
+ "name": "bench-beidou-big",
+ "version": "0.3.3",
+ "scripts": {
+ "start": "beidou-build && node ./bin/server.js"
+ },
+ "author": "",
+ "devDependencies": {
+ "babel-eslint": "^7.1.1",
+ "babel-loader": "^7.1.1",
+ "css-loader": "~0.23.1",
+ "eslint": "^4.11.0",
+ "eslint-config-beidou": "^1.0.0",
+ "extract-text-webpack-plugin": "^3.0.2",
+ "globby": "^6.1.0",
+ "husky": "^0.13.4",
+ "react-hot-loader": "^3.1.3",
+ "style-loader": "^0.19.0",
+ "webpack-hot-middleware": "^2.21.0"
+ },
+ "dependencies": {
+ "babel-preset-beidou-client": "^0.1.0",
+ "babel-preset-beidou-server": "^0.1.0",
+ "beidou-core": "^0.3.3",
+ "react": "^16.0.0",
+ "react-dom": "^16.0.0"
+ },
+ "engines": {
+ "node": ">= 6.0.0"
+ },
+ "license": "MIT"
+}
diff --git a/bench/next-big/README.md b/bench/next-big/README.md
new file mode 100644
index 0000000..db9dd1a
--- /dev/null
+++ b/bench/next-big/README.md
@@ -0,0 +1,21 @@
+```bash
+[Sat Dec 16 2017 20:36:04 GMT+0800 (CST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Target URL: http://127.0.0.1:3000
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Max requests: 50
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Concurrency level: 10
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Agent: none
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Completed requests: 50
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Total errors: 0
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Total time: 1.8213076780000002 s
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Requests per second: 27
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Mean latency: 352.3 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO Percentage of the requests served within a certain time
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO 50% 337 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO 90% 471 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO 95% 472 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO 99% 473 ms
+[Sat Dec 16 2017 20:36:06 GMT+0800 (CST)] INFO 100% 473 ms (longest request)
+```
diff --git a/bench/next-big/package.json b/bench/next-big/package.json
new file mode 100644
index 0000000..a5f31ed
--- /dev/null
+++ b/bench/next-big/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "bench-next",
+ "version": "1.0.0-15",
+ "scripts": {
+ "start": "NODE_ENV=production next build && NODE_ENV=production next start"
+ },
+ "dependencies": {
+ "next": "4.3.0-canary.1",
+ "react": "^16.2.0",
+ "react-dom": "^16.2.0"
+ }
+}
diff --git a/bench/next-big/pages/index.js b/bench/next-big/pages/index.js
new file mode 100644
index 0000000..43f3e29
--- /dev/null
+++ b/bench/next-big/pages/index.js
@@ -0,0 +1,13 @@
+import React from 'react';
+
+export default () => {
+ return ;
+};
+
+const items = () => {
+ const out = new Array(10000);
+ for (let i = 0; i < out.length; i++) {
+ out[i] = This is row {i + 1};
+ }
+ return out;
+};
diff --git a/bench/next-simple/README.md b/bench/next-simple/README.md
new file mode 100644
index 0000000..4985b2b
--- /dev/null
+++ b/bench/next-simple/README.md
@@ -0,0 +1,21 @@
+```bash
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Requests: 0 (0%), requests per second: 0, mean latency: 0 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Target URL: http://127.0.0.1:3000
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Max requests: 50
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Concurrency level: 10
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Agent: none
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Completed requests: 50
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Total errors: 0
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Total time: 0.078080892 s
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Requests per second: 640
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Mean latency: 13.4 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO Percentage of the requests served within a certain time
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO 50% 11 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO 90% 23 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO 95% 24 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO 99% 27 ms
+[Sat Dec 16 2017 20:43:29 GMT+0800 (CST)] INFO 100% 27 ms (longest request)
+```
diff --git a/bench/next-simple/package.json b/bench/next-simple/package.json
new file mode 100644
index 0000000..a5f31ed
--- /dev/null
+++ b/bench/next-simple/package.json
@@ -0,0 +1,12 @@
+{
+ "name": "bench-next",
+ "version": "1.0.0-15",
+ "scripts": {
+ "start": "NODE_ENV=production next build && NODE_ENV=production next start"
+ },
+ "dependencies": {
+ "next": "4.3.0-canary.1",
+ "react": "^16.2.0",
+ "react-dom": "^16.2.0"
+ }
+}
diff --git a/bench/next-simple/pages/index.js b/bench/next-simple/pages/index.js
new file mode 100644
index 0000000..41095fc
--- /dev/null
+++ b/bench/next-simple/pages/index.js
@@ -0,0 +1,3 @@
+import React from 'react';
+
+export default () => My component!
;
diff --git a/lerna.json b/lerna.json
index 6956a72..634bb50 100644
--- a/lerna.json
+++ b/lerna.json
@@ -15,21 +15,13 @@
},
"commands": {
"build": {
- "scope": [
- "avet-shared",
- "avet-client",
- "avet-utils"
- ]
+ "scope": ["avet-shared", "avet-client", "avet-utils"]
},
"publish": {
- "ignore": []
+ "ignore": ["bench/*"]
}
},
- "packages": [
- "packages/*"
- ],
+ "packages": ["packages/*", "bench/*"],
"npmClient": "npm",
- "npmClientArgs": [
- "--no-lockfile"
- ]
+ "npmClientArgs": ["--no-lockfile"]
}
diff --git a/package.json b/package.json
index 038c02c..90718f1 100644
--- a/package.json
+++ b/package.json
@@ -12,7 +12,8 @@
"doc:start":
"cross-env NODE_ENV=development && bisheng start -c ./site/bisheng.config.js",
"doc:build": "bisheng build --ssr -c ./site/bisheng.config.js",
- "doc:deploy": "bisheng gh-pages --ssr -c ./site/bisheng.config.js"
+ "doc:deploy": "bisheng gh-pages --ssr -c ./site/bisheng.config.js",
+ "bench": "loadtest -c 10 -n 50 http://127.0.0.1:3000"
},
"devDependencies": {
"antd": "^2.13.9",
@@ -33,6 +34,7 @@
"eslint-config-avet": "^0.3.7",
"lerna": "^2.5.1",
"lerna-changelog": "^0.7.0",
+ "loadtest": "^2.3.0",
"preact": "^8.2.5",
"preact-compat": "^3.17.0",
"rc-queue-anim": "^1.3.1",