Skip to content

Commit a35801f

Browse files
authored
perf: Add SSR best benchmark (salesforce#1956)
1 parent bd80057 commit a35801f

28 files changed

+144
-94
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,11 @@ jobs:
215215
name: Run BEST
216216
working_directory: packages/perf-benchmarks
217217
no_output_timeout: 40m
218-
command: yarn start --projects best.headless.config.js --externalStorage=@best/store-aws --runner remote --runInBatch --dbAdapter=sql/postgres --dbURI=${BEST_HUB_DATABASE_URL}
218+
command: yarn start --externalStorage=@best/store-aws --runner remote --runInBatch --dbAdapter=sql/postgres --dbURI=${BEST_HUB_DATABASE_URL}
219219
- run:
220220
name: Comparing Benchmarks
221221
working_directory: packages/perf-benchmarks
222-
command: yarn start --projects best.headless.config.js --compareStats ${BASE_COMMIT} ${TARGET_COMMIT} --externalStorage=@best/store-aws --gitIntegration
222+
command: yarn start --compareStats ${BASE_COMMIT} ${TARGET_COMMIT} --externalStorage=@best/store-aws --gitIntegration
223223
- store_artifacts:
224224
path: ~/lwc/packages/perf-benchmarks/__benchmark_results__/
225225
destination: benchmarks
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
* Copyright (c) 2018, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
8+
module.exports = function () {
9+
return {
10+
name: 'server-resolver',
11+
resolveId(src) {
12+
if (src === 'lwc' || src === '@lwc/engine-server') {
13+
return require.resolve('@lwc/engine-server/dist/engine-server.js');
14+
}
15+
16+
return null;
17+
},
18+
};
19+
};

packages/perf-benchmarks/best-plugins/synthetic-shadow.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
* SPDX-License-Identifier: MIT
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
7+
78
const SYNTHETIC_IMPORT = 'import "@lwc/synthetic-shadow";';
8-
/*
9-
* BEST-ROLLUP-PLUGIN
10-
* This module make sure all test run with synthetic-shadow enabled
11-
*/
9+
10+
/** This module make sure all test run with synthetic-shadow enabled */
1211
module.exports = function () {
1312
let input;
1413
return {

packages/perf-benchmarks/best.headless.config.js renamed to packages/perf-benchmarks/best.base.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
66
*/
77
module.exports = {
8-
projectName: 'lwc-engine-benchmark',
98
plugins: [
10-
'<rootDir>/best-plugins/synthetic-shadow.js',
119
[
1210
'@lwc/rollup-plugin',
1311
{
@@ -17,8 +15,10 @@ module.exports = {
1715
],
1816
['@rollup/plugin-replace', { 'process.env.NODE_ENV': JSON.stringify('production') }],
1917
],
18+
2019
benchmarkOnClient: false,
2120
benchmarkIterations: 60,
21+
2222
specs: { name: 'chrome.headless', version: '80' },
2323
runners: [
2424
{

packages/perf-benchmarks/best.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
*/
77
module.exports = {
88
projectName: 'lwc-engine-benchmark',
9-
projects: ['<rootDir>/best.ie11.config.js', '<rootDir>/best.headless.config.js'],
9+
projects: ['<rootDir>/best.dom.config.js', '<rootDir>/best.server.config.js'],
1010
};
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2018, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
8+
const config = require('./best.base.config');
9+
10+
module.exports = {
11+
...config,
12+
13+
projectName: '@lwc/engine-dom',
14+
testMatch: ['**/__benchmarks__/engine-dom/**/*.benchmark.js'],
15+
plugins: ['<rootDir>/best-plugins/synthetic-shadow.js', ...config.plugins],
16+
};

packages/perf-benchmarks/best.ie11.config.js

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/*
2+
* Copyright (c) 2018, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
8+
const config = require('./best.base.config');
9+
10+
module.exports = {
11+
...config,
12+
13+
projectName: '@lwc/engine-server',
14+
testMatch: ['**/__benchmarks__/engine-server/**/*.benchmark.js'],
15+
plugins: ['<rootDir>/best-plugins/server-resolver.js', ...config.plugins],
16+
};

packages/perf-benchmarks/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
"version": "1.7.5",
44
"private": true,
55
"scripts": {
6-
"start": "best",
7-
"remote": "best --projects best.headless.config.js --runner remote"
6+
"start": "best"
87
},
98
"devDependencies": {
109
"@best/cli": "4.0.0-beta5",

packages/perf-benchmarks/src/__benchmarks__/benchmark-table-component/tablecmp-append-1k.benchmark.js renamed to packages/perf-benchmarks/src/__benchmarks__/engine-dom/benchmark-table-component/tablecmp-append-1k.benchmark.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
*/
77

88
import { createElement } from 'lwc';
9-
import Table from 'benchmark/tableComponent';
109

11-
import Store from '../../tableStore';
12-
import { insertTableComponent, destroyTableComponent } from '../../utils';
10+
import Table from 'benchmark/tableComponent';
11+
import Store from 'benchmark/store';
12+
import { insertTableComponent, destroyTableComponent } from 'benchmark/utils';
1313

1414
benchmark(`benchmark-table-component/append/1k`, () => {
1515
let tableElement;

0 commit comments

Comments
 (0)