Skip to content

Commit

Permalink
update impls to swap rows 1/998 instead of 4/9
Browse files Browse the repository at this point in the history
(except reflex-dom)
  • Loading branch information
leeoniya committed Nov 21, 2017
1 parent 55bfdce commit bd602ab
Show file tree
Hide file tree
Showing 78 changed files with 299 additions and 299 deletions.
6 changes: 3 additions & 3 deletions angular-v1.6.3-keyed/src/home.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export class HomeController {
swapRows() {
startMeasure("swapRows");
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
this.printDuration();
};
Expand Down
6 changes: 3 additions & 3 deletions angular-v5.0.0-keyed/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ export class AppComponent implements AfterViewChecked {
swapRows() {
startMeasure("swapRows");
if (this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
}

Expand Down
6 changes: 3 additions & 3 deletions angular-v5.0.0-no-zone-keyed/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ export class AppComponent implements AfterViewChecked {
swapRows() {
startMeasure("swapRows");
if (this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
this.changeDetector.detectChanges();
}
Expand Down
8 changes: 4 additions & 4 deletions angular-v5.0.0-non-keyed/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class AppComponent implements AfterViewChecked {
}

itemByIndex(index: number, item: Data) {
return index;
return index;
}

select(item: Data, event: Event) {
Expand Down Expand Up @@ -145,9 +145,9 @@ export class AppComponent implements AfterViewChecked {
swapRows() {
startMeasure("swapRows");
if (this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
}

Expand Down
8 changes: 4 additions & 4 deletions aurelia-v1.1.5-non-keyed/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@ export class Store {
}
swapRows() {
if(this.data.length > 10) {
var a = this.data[4];
var b = this.data[9];
this.data.splice(4, 1, b);
this.data.splice(9, 1, a);
var a = this.data[1];
var b = this.data[998];
this.data.splice(1, 1, b);
this.data.splice(998, 1, a);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ final class Store {
def swapRows() = {
val buffer = data.get
if (buffer.length >= 10) {
val row4 = buffer(4)
val row9 = buffer(9)
buffer(9) = row4
buffer(4) = row9
val row1 = buffer(1)
val row998 = buffer(998)
buffer(998) = row1
buffer(1) = row998
}
}

Expand Down
6 changes: 3 additions & 3 deletions bobril-v8.0.1-keyed/src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export class Store {
}
swapRows() {
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
}
}
6 changes: 3 additions & 3 deletions choo-v6.5.0-keyed/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ module.exports = function(state, emitter) {

emitter.on('swapRows', function() {
if (state.data.length > 10) {
const a = state.data[4];
state.data[4] = state.data[9];
state.data[9] = a;
const a = state.data[1];
state.data[1] = state.data[998];
state.data[998] = a;
}
emitter.emit('render');
});
Expand Down
20 changes: 10 additions & 10 deletions cyclejs-dom-v19.3.0-non-keyed/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ let nouns = ['table', 'chair', 'house', 'bbq', 'desk', 'car', 'pony', 'cookie',

function buildData(count = 1000) {
var data = [];

for(var i = 0; i < count; i++) {
data.push({
id: id++,
label: adjectives[_random(adjectives.length)] + ' ' + colours[_random(colours.length)] + ' ' + nouns[_random(nouns.length)]
});
}

return data;
};

Expand All @@ -39,9 +39,9 @@ const Operations = {
SwapRows: state => {
let d = state.items.splice(0);
if(d.length > 10) {
var a = d[4];
d[4] = d[9];
d[9] = a;
var a = d[1];
d[1] = d[998];
d[998] = a;
}
return {items: d, selected: state.selected};
}
Expand All @@ -58,23 +58,23 @@ function intent(DOMSource) {
DOMSource.select('.remove').events('click').map(evt => {
evt.preventDefault();
evt.stopPropagation();

let el = evt.target;
while(el && !el.id) {
el = el.parentNode;
}

return Operations.RemoveItem(parseInt(el.id));
}),
DOMSource.select('.select').events('click').map(evt => {
evt.preventDefault();
evt.stopPropagation();

let el = evt.target;
while(el && !el.id) {
el = el.parentNode;
}

return Operations.SelectItem(parseInt(el.id));
})
);
Expand Down Expand Up @@ -143,7 +143,7 @@ function view(state$) {

function main(sources) {
const state$ = model(intent(sources.DOM));

return {
DOM: view(state$)
}
Expand Down
6 changes: 3 additions & 3 deletions datum-v0.10.0-keyed/src/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ var HomeViewModel = function () {
this.swapRows = new Datum.Click(function () {
startMeasure("swapRows");
if (this.data.length > 10) {
var a = this.data[4];
var b = this.data.splice(9, 1, a)[0];
this.data.splice(4, 1, b);
var a = this.data[1];
var b = this.data.splice(998, 1, a)[0];
this.data.splice(1, 1, b);
}
stopMeasure();
});
Expand Down
6 changes: 3 additions & 3 deletions dio-v8.0.3-keyed/src/utils.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const update = (data) => {
export const swapRows = (data) => {
const newData = [...data];
if (newData.length > 10) {
let temp = newData[4];
newData[4] = newData[9];
newData[9] = temp;
let temp = newData[1];
newData[1] = newData[998];
newData[998] = temp;
}
return newData;
}
Expand Down
6 changes: 3 additions & 3 deletions dio-v8.0.3-non-keyed/src/utils.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ export const update = (data) => {
export const swapRows = (data) => {
const newData = [...data];
if (newData.length > 10) {
let temp = newData[4];
newData[4] = newData[9];
newData[9] = temp;
let temp = newData[1];
newData[1] = newData[998];
newData[998] = temp;
}
return newData;
}
Expand Down
6 changes: 3 additions & 3 deletions dojo2-v0.2.0-keyed/src/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ export class Store {

public swapRows() {
if (this._data.length > 10) {
const row = this._data[4];
this._data[4] = this._data[9];
this._data[9] = row;
const row = this._data[1];
this._data[1] = this._data[998];
this._data[998] = row;
}
}
}
6 changes: 3 additions & 3 deletions dojo2-v0.2.0-non-keyed/src/Store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ export class Store {

public swapRows() {
if (this._data.length > 10) {
const row = this._data[4];
this._data[4] = this._data[9];
this._data[9] = row;
const row = this._data[1];
this._data[1] = this._data[998];
this._data[998] = row;
}
}
}
6 changes: 3 additions & 3 deletions domvm-v3.2.2-keyed/src/store.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Store.prototype = {

swapRows: function() {
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
},
};
6 changes: 3 additions & 3 deletions domvm-v3.2.2-non-keyed/src/store.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ Store.prototype = {

swapRows: function() {
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
},
};
8 changes: 4 additions & 4 deletions elm-v0.18.0-keyed/src/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -272,16 +272,16 @@ update msg model =
|> Array.fromList

from =
get 4 arr
get 1 arr

to =
get 9 arr
get 998 arr
in
( { model
| rows =
arr
|> Array.set 4 to
|> Array.set 9 from
|> Array.set 1 to
|> Array.set 998 from
|> Array.toList
}
, Cmd.none
Expand Down
12 changes: 6 additions & 6 deletions ember-v2.16.2-keyed/app/services/rows.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ export default Ember.Service.extend({
swapRows() {
startMeasure("swapRows");
if(this.data.length > 10) {
let d4 = this.data[4];
let d9 = this.data[9];
let d1 = this.data[1];
let d998 = this.data[998];

var data = this.data.map(function(data, i) {
if(i === 4) {
return d9;
if(i === 1) {
return d998;
}
else if(i === 9) {
return d4;
else if(i === 998) {
return d1;
}
return data;
});
Expand Down
6 changes: 3 additions & 3 deletions etch-v0.12.5-keyed/src/Store.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export class Store {
}
swapRows() {
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
}
}
6 changes: 3 additions & 3 deletions etch-v0.12.5-non-keyed/src/Store.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export class Store {
}
swapRows() {
if(this.data.length > 10) {
var a = this.data[4];
this.data[4] = this.data[9];
this.data[9] = a;
var a = this.data[1];
this.data[1] = this.data[998];
this.data[998] = a;
}
}
}
6 changes: 3 additions & 3 deletions glimmer-v0.8.0-keyed/src/ui/components/my-table/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export default class Glimmerjs extends Component {
startMeasure("swapRows");
if(this.rows.data.length > 10) {
let data = this.rows.data;
let d4 = data[4];
data[4] = data[9];
data[9] = d4;
let d1 = data[1];
data[1] = data[998];
data[998] = d1;
this.rows = { ...this.rows, data }
}
stopMeasure();
Expand Down
6 changes: 3 additions & 3 deletions gruu-v1.7.3-non-keyed/src/Store.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ export class Store {
}
swapRows () {
if(this.data.length > 10) {
const a = this.data[4]
this.data[4] = this.data[9]
this.data[9] = a
const a = this.data[1]
this.data[1] = this.data[998]
this.data[998] = a
}
}
}
4 changes: 2 additions & 2 deletions halogen-v2.1.0-non-keyed/src/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ render state =
[ HH.tbody_
$ map (renderRow state.selected) state.rows ]
, HH.span
[ HP.classes [ HH.ClassName "preloadicon glyphicon glyphicon-remove" ]
[ HP.classes [ HH.ClassName "preloadicon glyphicon glyphicon-remove" ]
, HP.attr (HH.AttrName "aria-hidden") "true" ]
[ HH.text "" ]
]
Expand Down Expand Up @@ -287,7 +287,7 @@ buttons =
, { bid: "add", str: "Append 1,000 Rows", q: Append 1000 }
, { bid: "update", str: "Update Every 10th Row", q: UpdateEvery 10 }
, { bid: "clear", str: "Clear", q: Clear }
, { bid: "swaprows", str: "Swap Rows", q: Swap 4 9 } ]
, { bid: "swaprows", str: "Swap Rows", q: Swap 1 998 } ]



Expand Down
Loading

0 comments on commit bd602ab

Please sign in to comment.