Skip to content

Commit 7bf1f46

Browse files
committed
Merge branch 'master' of https://github.com/gr0uch/js-framework-benchmark into gr0uch-master
2 parents cb515eb + 763f99a commit 7bf1f46

File tree

3 files changed

+28
-6
lines changed

3 files changed

+28
-6
lines changed

frameworks/keyed/s2/package-lock.json

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

frameworks/keyed/s2/package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"version": "1.0.0",
44
"description": "s2 demo",
55
"js-framework-benchmark": {
6-
"frameworkVersion": "1.0.0",
7-
"frameworkHomeURL": "",
8-
"issues": [800]
6+
"frameworkVersionFromPackage": "s2-engine",
7+
"frameworkHomeURL": "https://gr0uch.github.io/s2",
8+
"issues": [
9+
800
10+
]
911
},
1012
"scripts": {
1113
"build-dev": "echo 0",
@@ -20,5 +22,8 @@
2022
"repository": {
2123
"type": "git",
2224
"url": "https://github.com/krausest/js-framework-benchmark.git"
25+
},
26+
"dependencies": {
27+
"s2-engine": "^1.0.17"
2328
}
2429
}

frameworks/keyed/s2/src/bench.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import s2 from './main.min.js'
1+
import s2 from '../node_modules/s2-engine/dist/main.mjs';
22
//s2.debug=true
33
cleanupTemplates();
44

@@ -49,7 +49,7 @@ function select () {
4949
this.cls = 'danger';
5050
}
5151

52-
const [node, proxy] = s2(state, document.querySelector('#main'))
52+
const [proxy, node] = s2(state, document.querySelector('#main'))
5353
document.body.appendChild(node)
5454
window.p = proxy
5555

@@ -75,6 +75,15 @@ var id = 0
7575
function create (label, number) {
7676
return function () {
7777
bench(label, function () {
78+
// Technical note: the keyed behavior for array replacement can be forced
79+
// by resetting it first. Removing this would default to non-keyed behavior.
80+
//
81+
// This *could* be the default behavior in the library itself, but would be
82+
// a de-optimization for the common use case of replacing an array with another.
83+
// Even if the default behavior was keyed, non-keyed could still be forced by
84+
// mutating objects in the array.
85+
proxy.rows = null
86+
7887
proxy.rows = buildData(number)
7988
})
8089
}

0 commit comments

Comments
 (0)