Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0b066f

Browse files
update perf with 0.10 + persistence optimization
1 parent 868c68d commit f0b066f

File tree

5 files changed

+36
-43
lines changed

5 files changed

+36
-43
lines changed

‎perf/todomvc-benchmark/results.json‎

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,40 +6,40 @@
66
"Chrome": {
77
"version": 33,
88
"data": {
9-
"Vue": 299.81180001050234,
10-
"Backbone": 935.0203000358306,
11-
"Knockout": 551.3383000157773,
12-
"Ember": 1696.9891000189818,
13-
"Angular": 1975.2494000131264,
14-
"React": 1387.478999979794,
15-
"Om": 520.4139999346808,
16-
"Ractive": 1190.4445000225678
9+
"Vue": 237.26789999054745,
10+
"Backbone": 938.864299969282,
11+
"Knockout": 554.6399000333622,
12+
"Ember": 1704.0511999628507,
13+
"Angular": 1940.5865000095218,
14+
"React": 1340.8859000075608,
15+
"Om": 515.030100021977,
16+
"Ractive": 1161.6704000160098
1717
}
1818
},
1919
"Firefox": {
2020
"version": 27,
2121
"data": {
22-
"Vue": 411.8228302999975,
23-
"Backbone": 879.4766894999996,
24-
"Knockout": 477.17003809999994,
25-
"Ember": 1693.4060225999951,
26-
"Angular": 1421.9876616000101,
27-
"React": 899.4455852000046,
28-
"Om": 434.2891278000017,
29-
"Ractive": 1613.3944537999982
22+
"Vue": 369.09318099999666,
23+
"Backbone": 893.9444079000056,
24+
"Knockout": 552.2376080000018,
25+
"Ember": 1804.3003210999964,
26+
"Angular": 1493.9457980999912,
27+
"React": 1057.3607857000084,
28+
"Om": 529.9180196000009,
29+
"Ractive": 1612.7223065999956
3030
}
3131
},
3232
"Safari": {
3333
"version": 7,
3434
"data": {
35-
"Vue": 157,
36-
"Backbone": 713.7,
37-
"Knockout": 427.8,
38-
"Ember": 1025.5,
39-
"Angular": 1426.6,
40-
"React": 783.8,
41-
"Om": 422.2,
42-
"Ractive": 963.3
35+
"Vue": 148.2,
36+
"Backbone": 748.5,
37+
"Knockout": 460.2,
38+
"Ember": 1052.3,
39+
"Angular": 1464.2,
40+
"React": 816.4,
41+
"Om": 456.3,
42+
"Ractive": 994.6
4343
}
4444
}
4545
}

‎perf/todomvc-benchmark/vue/bower_components/vue/vue.js‎

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

‎perf/todomvc-benchmark/vue/index.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ <h1>todos</h1>
1717
<ul id="todo-list">
1818
<li class="todo" v-repeat="todos | filterTodos" v-class="completed: completed, editing: this == editedTodo">
1919
<div class="view">
20-
<input class="toggle" type="checkbox" v-model="completed"v-on="change: toggleTodo(this)">
20+
<input class="toggle" type="checkbox" v-model="completed">
2121
<label v-text="title" v-on="dblclick: editTodo(this)"></label>
2222
<button class="destroy" v-on="click: removeTodo(this)"></button>
2323
</div>

‎perf/todomvc-benchmark/vue/js/app.js‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@
2929
filter: 'all'
3030
},
3131

32+
ready: function () {
33+
this.$watch('todos', function (todos) {
34+
todoStorage.save(todos);
35+
});
36+
},
37+
3238
// a custom directive to wait for the DOM to be updated
3339
// before focusing on the input field.
3440
// http://vuejs.org/guide/directives.html#Writing_a_Custom_Directive
@@ -64,7 +70,6 @@
6470
this.todos.forEach(function (todo) {
6571
todo.completed = value;
6672
});
67-
todoStorage.save();
6873
}
6974
}
7075
},
@@ -80,16 +85,10 @@
8085
}
8186
this.todos.push({ title: value, completed: false });
8287
this.newTodo = '';
83-
todoStorage.save();
8488
},
8589

8690
removeTodo: function (todo) {
8791
this.todos.$remove(todo.$data);
88-
todoStorage.save();
89-
},
90-
91-
toggleTodo: function (todo) {
92-
todoStorage.save();
9392
},
9493

9594
editTodo: function (todo) {
@@ -106,7 +105,6 @@
106105
if (!todo.title) {
107106
this.removeTodo(todo);
108107
}
109-
todoStorage.save();
110108
},
111109

112110
cancelEdit: function (todo) {
@@ -116,7 +114,6 @@
116114

117115
removeCompleted: function () {
118116
this.todos = this.todos.filter(filters.active);
119-
todoStorage.save();
120117
}
121118
}
122119
});

‎perf/todomvc-benchmark/vue/js/store.js‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@
55
'use strict';
66

77
var STORAGE_KEY = 'todos-vuejs';
8-
var todos = null;
98

109
exports.todoStorage = {
1110
fetch: function () {
12-
if (!todos) {
13-
todos = JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]');
14-
}
15-
return todos;
11+
return JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]');
1612
},
17-
save: function () {
13+
save: function (todos) {
1814
localStorage.setItem(STORAGE_KEY, JSON.stringify(todos));
1915
}
2016
};

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /