[Pkg-javascript-commits] [backbone] 13/34: a handful of model speed tests.

Jonas Smedegaard js at moszumanska.debian.org
Sat May 3 16:58:44 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag 0.1.2
in repository backbone.

commit 500d66bd58ae472dafe9759658592b9433937109
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date:   Thu Oct 14 15:11:56 2010 -0400

    a handful of model speed tests.
---
 backbone.js   |  2 +-
 test/speed.js | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/backbone.js b/backbone.js
index d0a1acc..c219f51 100644
--- a/backbone.js
+++ b/backbone.js
@@ -135,7 +135,7 @@
       // Extract attributes and options.
       options || (options = {});
       if (!attrs) return this;
-      attrs = attrs.attributes || attrs;
+      if (attrs.attributes) attrs = attrs.attributes;
       var now = this.attributes;
 
       // Run validation if `validate` is defined.
diff --git a/test/speed.js b/test/speed.js
index 0f29d47..6cd0b66 100644
--- a/test/speed.js
+++ b/test/speed.js
@@ -22,4 +22,24 @@
     object.trigger('test:trigger2', 1, 2, 3, 4, 5);
   });
 
+  var model = new Backbone.Model;
+
+  JSLitmus.test('Model: set Math.random()', function() {
+    model.set({number: Math.random()});
+  });
+
+  var eventModel = new Backbone.Model;
+  eventModel.bind('change', fn);
+
+  JSLitmus.test('Model: set Math.random() with a change event', function() {
+    eventModel.set({number: Math.random()});
+  });
+
+  var keyModel = new Backbone.Model;
+  keyModel.bind('change:number', fn);
+
+  JSLitmus.test('Model: set Math.random() with a key-value observer', function() {
+    keyModel.set({number: Math.random()});
+  });
+
 })();
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git



More information about the Pkg-javascript-commits mailing list