Skip to content

Commit 6b2bac4

Browse files
committed
Merge branch 'master' of github.com:krausest/js-framework-benchmark
2 parents 7d46941 + 2938623 commit 6b2bac4

33 files changed

+11465
-4924
lines changed

frameworks/keyed/doohtml/js/Main.class.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Doo.define(
9696
add() {
9797
let start = this.data.rows.length
9898
this.data.rows = this.data.rows.concat(this.buildData())
99-
this.append(this.data.rows.slice(start), this.tbody, start)
99+
this.append(this.data.rows, this.tbody, start)
100100
}
101101

102102
runLots() {

frameworks/keyed/doohtml/js/doo.html.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/doohtml/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "js-framework-benchmark-doohtml",
3-
"version": "0.60.11",
3+
"version": "0.80.2",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

frameworks/keyed/san-store/.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015", "stage-0"]
3+
}

frameworks/keyed/san-store/package-lock.json

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

frameworks/keyed/san-store/package.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
]
1010
},
1111
"scripts": {
12-
"build-dev": "webpack --watch",
13-
"build-prod": "webpack"
12+
"build-dev": "webpack -w -d",
13+
"build-prod": "webpack -p"
1414
},
1515
"keywords": [
1616
"san",
@@ -24,15 +24,17 @@
2424
"url": "https://github.com/krausest/js-framework-benchmark.git"
2525
},
2626
"devDependencies": {
27-
"@babel/core": "7.19.1",
28-
"@babel/preset-env": "7.19.1",
29-
"babel-loader": "8.2.5",
30-
"webpack": "5.68.0",
31-
"webpack-cli": "4.9.2"
27+
"babel-core": "6.26.3",
28+
"babel-loader": "7.1.5",
29+
"babel-preset-es2015": "6.24.1",
30+
"babel-preset-stage-0": "6.24.1",
31+
"css-loader": "1.0.0",
32+
"webpack": "4.16.3",
33+
"webpack-cli": "3.1.0"
3234
},
3335
"dependencies": {
3436
"san": "3.12.0",
35-
"san-update": "2.1.0",
36-
"san-store": "2.1.3"
37+
"san-store": "2.1.3",
38+
"san-update": "2.1.0"
3739
}
3840
}

frameworks/keyed/san-store/src/App.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import {Component} from 'san';
22
import {connectSan} from './store';
33

44
class AppComponent extends Component {
5+
static trimWhitespace = 'all';
6+
static autoFillStyleAndId = false;
57
static template = `
68
<div class="container">
79
<div class="jumbotron">
@@ -35,7 +37,7 @@ class AppComponent extends Component {
3537
</div>
3638
<table class="table table-hover table-striped test-data" on-click="handleClick($event)">
3739
<tbody>
38-
<tr s-for="item in rows trackBy item.id" class="{{selected === item.id ? 'danger':''}}">
40+
<tr s-for="item in rows trackBy item.id" class="{{item.selected ? 'danger':''}}">
3941
<td class="col-md-1">{{item.id}}</td>
4042
<td class="col-md-4">
4143
<a data-action="select" data-id="{{item.id}}">{{item.label}}</a>
@@ -87,8 +89,7 @@ class AppComponent extends Component {
8789

8890
export default connectSan(
8991
{
90-
rows: 'rows',
91-
selected: 'selected'
92+
rows: 'rows'
9293
},
9394
{
9495
run: 'run',

frameworks/keyed/san-store/src/store.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,70 @@ const C = ['red', 'yellow', 'blue', 'green', 'pink', 'brown', 'purple', 'brown',
88
const N = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie', 'sandwich', 'burger', 'pizza',
99
'mouse', 'keyboard'];
1010

11-
const random = max => Math.round(Math.random() * 1000) % max;
11+
function random(max) {
12+
return Math.round(Math.random() * 1000) % max;
13+
}
1214

1315
let nextId = 1;
1416
function buildData(count = 1000) {
1517
const data = [];
1618
for (let i = 0; i < count; i++) {
1719
data.push({
1820
id: nextId++,
19-
label: `${A[random(A.length)]} ${C[random(C.length)]} ${N[random(N.length)]}`
21+
label: A[random(A.length)] + " " + C[random(C.length)] + " " + N[random(N.length)],
22+
selected: false
2023
});
2124
}
2225
return data;
2326
}
2427

2528
const store = new Store({
2629
initData: {
27-
rows: [],
28-
selected: 0
30+
rows: []
2931
},
3032

3133
actions: {
32-
setSelected(id) {
33-
return builder().set('selected', id);
34+
setSelected(id, {getState, dispatch}) {
35+
const rows = getState('rows');
36+
const newData = rows.slice(0);
37+
38+
rows.forEach((el, i) => {
39+
if (el.selected) {
40+
newData[i] = {...rows[i], selected: false}
41+
}
42+
if (el.id === id) {
43+
newData[i] = {...rows[i], selected: true}
44+
}
45+
});
46+
return builder().set('rows', newData);
3447
},
35-
run(n, {dispatch}) {
36-
dispatch('setSelected', 0);
48+
run(n) {
3749
return builder().set('rows', buildData(n));
3850
},
3951
add(n, {getState}) {
4052
const rows = getState('rows');
4153
return builder().set('rows', rows.concat(buildData(n)));
4254
},
4355
update(n, {getState}) {
44-
const newData = getState('rows').slice();
56+
const newData = getState('rows').slice(0);
4557
for (let i = 0; i < newData.length; i += 10) {
4658
const r = newData[i];
4759
newData[i] = {id: r.id, label: r.label + ' !!!'};
4860
}
4961
return builder().set('rows', newData);
5062
},
51-
clear(n, {dispatch}) {
52-
dispatch('setSelected', 0);
63+
clear(n) {
5364
return builder().set('rows', []);
5465
},
5566
remove(id, {getState}) {
56-
const newData = getState('rows').slice();
67+
const newData = getState('rows').slice(0);
5768
const idx = newData.findIndex(d => d.id === id);
5869

5970
newData.splice(idx, 1);
6071
return builder().set('rows', newData);
6172
},
6273
swapRows(n, {getState}) {
63-
const newData = getState('rows').slice();
74+
const newData = getState('rows').slice(0);
6475
if (newData.length > 998) {
6576
const tmp = newData[1];
6677
newData[1] = newData[998];
Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
'use strict';
22
var path = require('path');
3+
var webpack = require('webpack');
4+
var cache = {};
5+
var loaders = [
36

4-
module.exports = {
5-
mode: 'production',
7+
{
8+
test: /\.js$/,
9+
loader: 'babel-loader',
10+
exclude: /node_modules/
11+
},
12+
{
13+
test: /\.css$/,
14+
loader: 'style-loader!css-loader'
15+
}
16+
17+
];
18+
var extensions = [
19+
'.js', '.jsx', '.es6.js', '.msx'
20+
];
21+
22+
module.exports = [{
23+
cache: cache,
624
module: {
7-
rules: [
8-
{
9-
test: /\.js$/,
10-
use: {
11-
loader: 'babel-loader',
12-
options: {
13-
presets: [
14-
['@babel/preset-env', {targets: 'defaults'}]
15-
]
16-
}
17-
}
18-
}
19-
]
25+
rules: loaders
2026
},
2127
entry: {
2228
main: './src/main'
@@ -32,9 +38,14 @@ module.exports = {
3238
path.resolve(__dirname, "src"),
3339
"node_modules"
3440
],
35-
extensions: ['.js'],
41+
extensions: extensions,
3642
alias: {
3743
'san': 'san/dist/san.spa.modern.js'
3844
}
39-
}
40-
};
45+
},
46+
plugins: [
47+
new webpack.DefinePlugin({
48+
'process.env.NODE_ENV': '"production"'
49+
})
50+
]
51+
}];
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
/target
3+
/pkg
4+
/wasm-pack.log
5+
/yarn-error.log

0 commit comments

Comments
 (0)