Skip to content

Commit bbb59d8

Browse files
committed
Merge branch 'DooHTML-DOM-v0.92.1-beta' of https://github.com/hman61/js-framework-benchmark into hman61-DooHTML-DOM-v0.92.1-beta
2 parents ed58fda + 2a4a846 commit bbb59d8

File tree

10 files changed

+70
-131
lines changed

10 files changed

+70
-131
lines changed

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

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Doo.define(
2323
this.runLots = this.runLots.bind(this)
2424
this.update = this.update.bind(this)
2525
this.clear = this.clear.bind(this)
26-
this.swaprows = this.swapRows.bind(this)
26+
this.swapRows = this.swapRows.bind(this)
2727
this.addEventListeners()
2828
this.selectedRow = undefined
2929
document.querySelector(".ver").innerHTML += ` ${Doo.version} (keyed)`
@@ -58,20 +58,15 @@ Doo.define(
5858
return data
5959
}
6060
getIndex(row) {
61-
let idx = this.data.rows.findIndex((item, i) => {
62-
if (item.id === row.key) {
63-
return i
64-
}
65-
})
66-
return idx
61+
return this.data.rows.findIndex((item, i) => item.id === row.key)
6762
}
6863

6964
delete(elem) {
7065
let row = this.getParentRow(elem)
7166
if (row) {
7267
let idx = this.getIndex(row)
7368
this.tbody.removeChild(row)
74-
if (idx !== undefined) {
69+
if (idx !== undefined && idx !== -1) {
7570
this.data.rows.splice(idx,1)
7671
}
7772
}
@@ -134,29 +129,28 @@ Doo.define(
134129

135130
this.data.rows[CHILD_1] = this.data.rows[CHILD_998];
136131
this.data.rows[CHILD_998] = row1
137-
this.tbody.insertBefore(swapRow, node1)
138-
this.tbody.insertBefore(node1, node999)
132+
this.tbody.insertBefore(node1.parentNode.replaceChild(swapRow, node1), node999)
139133
}
140134
}
141135

142136
addEventListeners() {
143-
document.getElementById("main").addEventListener('click', e => {
144-
e.preventDefault()
145-
if (e.target.matches('#runlots')) {
146-
this.runLots()
147-
} else if (e.target.matches('#run')) {
148-
this.run()
149-
} else if (e.target.matches('#add')) {
150-
this.add()
151-
} else if (e.target.matches('#update')) {
152-
this.update()
153-
} else if (e.target.matches('#clear')) {
154-
this.clear()
155-
} else if (e.target.matches('#swaprows')) {
156-
this.swapRows()
137+
const actions = {
138+
'run': this.run,
139+
'runlots': this.runLots,
140+
'add': this.add,
141+
'update': this.update,
142+
'clear': this.clear,
143+
'swaprows': this.swapRows,
144+
runAction: (e) => {
145+
e.preventDefault()
146+
if (actions[e.target.id]) {
147+
actions[e.target.id]()
148+
}
157149
}
158-
})
150+
}
151+
document.getElementById("main").addEventListener('click', e => actions.runAction(e))
159152
}
153+
160154
async connectedCallback() {
161155
super.connectedCallback()
162156
}

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

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

frameworks/keyed/doohtml-dom/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.91.7-beta",
3+
"version": "0.92.1",
44
"description": "DooHTML-DOM (no shadow) JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Doo.define(
2626
this.runLots = this.runLots.bind(this)
2727
this.update = this.update.bind(this)
2828
this.clear = this.clear.bind(this)
29-
this.swaprows = this.swapRows.bind(this)
29+
this.swapRows = this.swapRows.bind(this)
3030
this.addEventListeners()
3131
this.selectedRow = undefined
3232
document.querySelector(".ver").innerHTML += ` ${Doo.version} (keyed)`
@@ -143,23 +143,23 @@ Doo.define(
143143
}
144144

145145
addEventListeners() {
146-
document.getElementById("main").addEventListener('click', e => {
147-
e.preventDefault()
148-
if (e.target.matches('#runlots')) {
149-
this.runLots()
150-
} else if (e.target.matches('#run')) {
151-
this.run()
152-
} else if (e.target.matches('#add')) {
153-
this.add()
154-
} else if (e.target.matches('#update')) {
155-
this.update()
156-
} else if (e.target.matches('#clear')) {
157-
this.clear()
158-
} else if (e.target.matches('#swaprows')) {
159-
this.swapRows()
146+
const actions = {
147+
'run': this.run,
148+
'runlots': this.runLots,
149+
'add': this.add,
150+
'update': this.update,
151+
'clear': this.clear,
152+
'swaprows': this.swapRows,
153+
runAction: (e) => {
154+
e.preventDefault()
155+
if (actions[e.target.id]) {
156+
actions[e.target.id]()
157+
}
160158
}
161-
})
159+
}
160+
document.getElementById("main").addEventListener('click', e => actions.runAction(e))
162161
}
162+
163163
async connectedCallback() {
164164
super.connectedCallback()
165165
}

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

Lines changed: 2 additions & 20 deletions
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.91.7-beta",
3+
"version": "0.92.1",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

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

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "b
77
const nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"]
88

99
const lenA = adjectives.length, lenB = colours.length, lenC = nouns.length
10-
1110
const DEFAULT_SIZE = 1000
1211
const CHILD_1 = 1
1312
const CHILD_998 = 998
@@ -25,7 +24,7 @@ Doo.define(
2524
this.runLots = this.runLots.bind(this)
2625
this.update = this.update.bind(this)
2726
this.clear = this.clear.bind(this)
28-
this.swaprows = this.swapRows.bind(this)
27+
this.swapRows = this.swapRows.bind(this)
2928
this.addEventListeners()
3029
this.selectedRow = undefined
3130
document.querySelector(".ver").innerHTML += ` ${Doo.version} (non-keyed)`
@@ -70,7 +69,7 @@ Doo.define(
7069

7170
run() {
7271
this.data.rows = this.buildData()
73-
if (this.tbody.childNodes.length > this.data.rows.length) {
72+
if (this.tbody.childNodes.length >= this.data.rows.length) {
7473
this.tbody.textContent = ''
7574
}
7675
this.renderTable()
@@ -115,38 +114,38 @@ Doo.define(
115114
isRowSelected(elem) {
116115
return elem.classList.contains('danger')
117116
}
117+
118118
swapRows() {
119119
if (this.data.rows.length > CHILD_998) {
120120
let node1 = this.tbody.childNodes[CHILD_1],
121-
swapRow = this.tbody.childNodes[CHILD_998],
122-
node999 = swapRow.nextSibling,
123-
row1 = this.data.rows[CHILD_1]
124-
121+
swapRow = this.tbody.childNodes[CHILD_998],
122+
node999 = swapRow.nextSibling,
123+
row1 = this.data.rows[CHILD_1]
124+
125125
this.data.rows[CHILD_1] = this.data.rows[CHILD_998];
126126
this.data.rows[CHILD_998] = row1
127-
this.tbody.insertBefore(swapRow, node1)
128-
this.tbody.insertBefore(node1, node999)
127+
this.tbody.insertBefore(swapRow, node1)
128+
this.tbody.insertBefore(node1, node999)
129129
}
130-
}
131-
130+
}
132131

133132
addEventListeners() {
134-
document.getElementById("main").addEventListener('click', e => {
135-
e.preventDefault()
136-
if (e.target.matches('#runlots')) {
137-
this.runLots()
138-
} else if (e.target.matches('#run')) {
139-
this.run()
140-
} else if (e.target.matches('#add')) {
141-
this.add()
142-
} else if (e.target.matches('#update')) {
143-
this.update()
144-
} else if (e.target.matches('#clear')) {
145-
this.clear()
146-
} else if (e.target.matches('#swaprows')) {
147-
this.swapRows()
133+
const actions = {
134+
'run': this.run,
135+
'runlots': this.runLots,
136+
'add': this.add,
137+
'update': this.update,
138+
'clear': this.clear,
139+
'swaprows': this.swapRows,
140+
runAction: (e) => {
141+
e.preventDefault()
142+
if (actions[e.target.id]) {
143+
actions[e.target.id]()
144+
}
148145
}
149-
})
146+
}
147+
148+
document.getElementById("main").addEventListener('click', e => actions.runAction(e))
150149
}
151150
async connectedCallback() {
152151
super.connectedCallback()

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

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

frameworks/non-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.91.7",
3+
"version": "0.92.1",
44
"description": "DooHTML JS-Benchmark",
55
"main": "Main.class.js",
66
"js-framework-benchmark": {

webdriver-ts/src/timeline.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export async function computeResultsCPU(
179179
}
180180
if (mousedownToClick > 10000) {
181181
console.log("difference between mousedown and click is unusually long", mousedownToClick, fileName);
182-
throw "difference between mousedown and click is unusually long";
182+
// throw "difference between mousedown and click is unusually long";
183183
}
184184
}
185185

0 commit comments

Comments
 (0)