Skip to content

Commit bd602ab

Browse files
committed
update impls to swap rows 1/998 instead of 4/9
(except reflex-dom)
1 parent 55bfdce commit bd602ab

File tree

78 files changed

+299
-299
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+299
-299
lines changed

angular-v1.6.3-keyed/src/home.controller.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ export class HomeController {
8686
swapRows() {
8787
startMeasure("swapRows");
8888
if(this.data.length > 10) {
89-
var a = this.data[4];
90-
this.data[4] = this.data[9];
91-
this.data[9] = a;
89+
var a = this.data[1];
90+
this.data[1] = this.data[998];
91+
this.data[998] = a;
9292
}
9393
this.printDuration();
9494
};

angular-v5.0.0-keyed/src/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,9 +145,9 @@ export class AppComponent implements AfterViewChecked {
145145
swapRows() {
146146
startMeasure("swapRows");
147147
if (this.data.length > 10) {
148-
var a = this.data[4];
149-
this.data[4] = this.data[9];
150-
this.data[9] = a;
148+
var a = this.data[1];
149+
this.data[1] = this.data[998];
150+
this.data[998] = a;
151151
}
152152
}
153153

angular-v5.0.0-no-zone-keyed/src/app.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ export class AppComponent implements AfterViewChecked {
152152
swapRows() {
153153
startMeasure("swapRows");
154154
if (this.data.length > 10) {
155-
var a = this.data[4];
156-
this.data[4] = this.data[9];
157-
this.data[9] = a;
155+
var a = this.data[1];
156+
this.data[1] = this.data[998];
157+
this.data[998] = a;
158158
}
159159
this.changeDetector.detectChanges();
160160
}

angular-v5.0.0-non-keyed/src/app.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class AppComponent implements AfterViewChecked {
9696
}
9797

9898
itemByIndex(index: number, item: Data) {
99-
return index;
99+
return index;
100100
}
101101

102102
select(item: Data, event: Event) {
@@ -145,9 +145,9 @@ export class AppComponent implements AfterViewChecked {
145145
swapRows() {
146146
startMeasure("swapRows");
147147
if (this.data.length > 10) {
148-
var a = this.data[4];
149-
this.data[4] = this.data[9];
150-
this.data[9] = a;
148+
var a = this.data[1];
149+
this.data[1] = this.data[998];
150+
this.data[998] = a;
151151
}
152152
}
153153

aurelia-v1.1.5-non-keyed/src/store.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export class Store {
6666
}
6767
swapRows() {
6868
if(this.data.length > 10) {
69-
var a = this.data[4];
70-
var b = this.data[9];
71-
this.data.splice(4, 1, b);
72-
this.data.splice(9, 1, a);
69+
var a = this.data[1];
70+
var b = this.data[998];
71+
this.data.splice(1, 1, b);
72+
this.data.splice(998, 1, a);
7373
}
7474
}
7575

binding.scala-v10.0.1-keyed/js/src/main/scala/com/thoughtworks/binding/benchmark/Store.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ final class Store {
128128
def swapRows() = {
129129
val buffer = data.get
130130
if (buffer.length >= 10) {
131-
val row4 = buffer(4)
132-
val row9 = buffer(9)
133-
buffer(9) = row4
134-
buffer(4) = row9
131+
val row1 = buffer(1)
132+
val row998 = buffer(998)
133+
buffer(998) = row1
134+
buffer(1) = row998
135135
}
136136
}
137137

bobril-v8.0.1-keyed/src/store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ export class Store {
6969
}
7070
swapRows() {
7171
if(this.data.length > 10) {
72-
var a = this.data[4];
73-
this.data[4] = this.data[9];
74-
this.data[9] = a;
72+
var a = this.data[1];
73+
this.data[1] = this.data[998];
74+
this.data[998] = a;
7575
}
7676
}
7777
}

choo-v6.5.0-keyed/src/store.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ module.exports = function(state, emitter) {
3737

3838
emitter.on('swapRows', function() {
3939
if (state.data.length > 10) {
40-
const a = state.data[4];
41-
state.data[4] = state.data[9];
42-
state.data[9] = a;
40+
const a = state.data[1];
41+
state.data[1] = state.data[998];
42+
state.data[998] = a;
4343
}
4444
emitter.emit('render');
4545
});

cyclejs-dom-v19.3.0-non-keyed/src/main.jsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ let nouns = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie',
1717

1818
function buildData(count = 1000) {
1919
var data = [];
20-
20+
2121
for(var i = 0; i < count; i++) {
2222
data.push({
2323
id: id++,
2424
label: adjectives[_random(adjectives.length)] + ' ' + colours[_random(colours.length)] + ' ' + nouns[_random(nouns.length)]
2525
});
2626
}
27-
27+
2828
return data;
2929
};
3030

@@ -39,9 +39,9 @@ const Operations = {
3939
SwapRows: state => {
4040
let d = state.items.splice(0);
4141
if(d.length > 10) {
42-
var a = d[4];
43-
d[4] = d[9];
44-
d[9] = a;
42+
var a = d[1];
43+
d[1] = d[998];
44+
d[998] = a;
4545
}
4646
return {items: d, selected: state.selected};
4747
}
@@ -58,23 +58,23 @@ function intent(DOMSource) {
5858
DOMSource.select('.remove').events('click').map(evt => {
5959
evt.preventDefault();
6060
evt.stopPropagation();
61-
61+
6262
let el = evt.target;
6363
while(el && !el.id) {
6464
el = el.parentNode;
6565
}
66-
66+
6767
return Operations.RemoveItem(parseInt(el.id));
6868
}),
6969
DOMSource.select('.select').events('click').map(evt => {
7070
evt.preventDefault();
7171
evt.stopPropagation();
72-
72+
7373
let el = evt.target;
7474
while(el && !el.id) {
7575
el = el.parentNode;
7676
}
77-
77+
7878
return Operations.SelectItem(parseInt(el.id));
7979
})
8080
);
@@ -143,7 +143,7 @@ function view(state$) {
143143

144144
function main(sources) {
145145
const state$ = model(intent(sources.DOM));
146-
146+
147147
return {
148148
DOM: view(state$)
149149
}

datum-v0.10.0-keyed/src/Main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ var HomeViewModel = function () {
8888
this.swapRows = new Datum.Click(function () {
8989
startMeasure("swapRows");
9090
if (this.data.length > 10) {
91-
var a = this.data[4];
92-
var b = this.data.splice(9, 1, a)[0];
93-
this.data.splice(4, 1, b);
91+
var a = this.data[1];
92+
var b = this.data.splice(998, 1, a)[0];
93+
this.data.splice(1, 1, b);
9494
}
9595
stopMeasure();
9696
});

dio-v8.0.3-keyed/src/utils.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export const update = (data) => {
3737
export const swapRows = (data) => {
3838
const newData = [...data];
3939
if (newData.length > 10) {
40-
let temp = newData[4];
41-
newData[4] = newData[9];
42-
newData[9] = temp;
40+
let temp = newData[1];
41+
newData[1] = newData[998];
42+
newData[998] = temp;
4343
}
4444
return newData;
4545
}

dio-v8.0.3-non-keyed/src/utils.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export const update = (data) => {
3737
export const swapRows = (data) => {
3838
const newData = [...data];
3939
if (newData.length > 10) {
40-
let temp = newData[4];
41-
newData[4] = newData[9];
42-
newData[9] = temp;
40+
let temp = newData[1];
41+
newData[1] = newData[998];
42+
newData[998] = temp;
4343
}
4444
return newData;
4545
}

dojo2-v0.2.0-keyed/src/Store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ export class Store {
134134

135135
public swapRows() {
136136
if (this._data.length > 10) {
137-
const row = this._data[4];
138-
this._data[4] = this._data[9];
139-
this._data[9] = row;
137+
const row = this._data[1];
138+
this._data[1] = this._data[998];
139+
this._data[998] = row;
140140
}
141141
}
142142
}

dojo2-v0.2.0-non-keyed/src/Store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ export class Store {
134134

135135
public swapRows() {
136136
if (this._data.length > 10) {
137-
const row = this._data[4];
138-
this._data[4] = this._data[9];
139-
this._data[9] = row;
137+
const row = this._data[1];
138+
this._data[1] = this._data[998];
139+
this._data[998] = row;
140140
}
141141
}
142142
}

domvm-v3.2.2-keyed/src/store.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Store.prototype = {
7878

7979
swapRows: function() {
8080
if(this.data.length > 10) {
81-
var a = this.data[4];
82-
this.data[4] = this.data[9];
83-
this.data[9] = a;
81+
var a = this.data[1];
82+
this.data[1] = this.data[998];
83+
this.data[998] = a;
8484
}
8585
},
8686
};

domvm-v3.2.2-non-keyed/src/store.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ Store.prototype = {
7878

7979
swapRows: function() {
8080
if(this.data.length > 10) {
81-
var a = this.data[4];
82-
this.data[4] = this.data[9];
83-
this.data[9] = a;
81+
var a = this.data[1];
82+
this.data[1] = this.data[998];
83+
this.data[998] = a;
8484
}
8585
},
8686
};

elm-v0.18.0-keyed/src/Main.elm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,16 +272,16 @@ update msg model =
272272
|> Array.fromList
273273

274274
from =
275-
get 4 arr
275+
get 1 arr
276276

277277
to =
278-
get 9 arr
278+
get 998 arr
279279
in
280280
( { model
281281
| rows =
282282
arr
283-
|> Array.set 4 to
284-
|> Array.set 9 from
283+
|> Array.set 1 to
284+
|> Array.set 998 from
285285
|> Array.toList
286286
}
287287
, Cmd.none

ember-v2.16.2-keyed/app/services/rows.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ export default Ember.Service.extend({
8787
swapRows() {
8888
startMeasure("swapRows");
8989
if(this.data.length > 10) {
90-
let d4 = this.data[4];
91-
let d9 = this.data[9];
90+
let d1 = this.data[1];
91+
let d998 = this.data[998];
9292

9393
var data = this.data.map(function(data, i) {
94-
if(i === 4) {
95-
return d9;
94+
if(i === 1) {
95+
return d998;
9696
}
97-
else if(i === 9) {
98-
return d4;
97+
else if(i === 998) {
98+
return d1;
9999
}
100100
return data;
101101
});

etch-v0.12.5-keyed/src/Store.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export class Store {
5151
}
5252
swapRows() {
5353
if(this.data.length > 10) {
54-
var a = this.data[4];
55-
this.data[4] = this.data[9];
56-
this.data[9] = a;
54+
var a = this.data[1];
55+
this.data[1] = this.data[998];
56+
this.data[998] = a;
5757
}
5858
}
5959
}

etch-v0.12.5-non-keyed/src/Store.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export class Store {
5151
}
5252
swapRows() {
5353
if(this.data.length > 10) {
54-
var a = this.data[4];
55-
this.data[4] = this.data[9];
56-
this.data[9] = a;
54+
var a = this.data[1];
55+
this.data[1] = this.data[998];
56+
this.data[998] = a;
5757
}
5858
}
5959
}

glimmer-v0.8.0-keyed/src/ui/components/my-table/component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ export default class Glimmerjs extends Component {
8080
startMeasure("swapRows");
8181
if(this.rows.data.length > 10) {
8282
let data = this.rows.data;
83-
let d4 = data[4];
84-
data[4] = data[9];
85-
data[9] = d4;
83+
let d1 = data[1];
84+
data[1] = data[998];
85+
data[998] = d1;
8686
this.rows = { ...this.rows, data }
8787
}
8888
stopMeasure();

gruu-v1.7.3-non-keyed/src/Store.es6.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ export class Store {
5151
}
5252
swapRows () {
5353
if(this.data.length > 10) {
54-
const a = this.data[4]
55-
this.data[4] = this.data[9]
56-
this.data[9] = a
54+
const a = this.data[1]
55+
this.data[1] = this.data[998]
56+
this.data[998] = a
5757
}
5858
}
5959
}

halogen-v2.1.0-non-keyed/src/Main.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ render state =
222222
[ HH.tbody_
223223
$ map (renderRow state.selected) state.rows ]
224224
, HH.span
225-
[ HP.classes [ HH.ClassName "preloadicon glyphicon glyphicon-remove" ]
225+
[ HP.classes [ HH.ClassName "preloadicon glyphicon glyphicon-remove" ]
226226
, HP.attr (HH.AttrName "aria-hidden") "true" ]
227227
[ HH.text "" ]
228228
]
@@ -287,7 +287,7 @@ buttons =
287287
, { bid: "add", str: "Append 1,000 Rows", q: Append 1000 }
288288
, { bid: "update", str: "Update Every 10th Row", q: UpdateEvery 10 }
289289
, { bid: "clear", str: "Clear", q: Clear }
290-
, { bid: "swaprows", str: "Swap Rows", q: Swap 4 9 } ]
290+
, { bid: "swaprows", str: "Swap Rows", q: Swap 1 998 } ]
291291

292292

293293

0 commit comments

Comments
 (0)