Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add speed tests. yikes, ~40% slower on a simple benchmark. the culpri…

…t isnt regex checking, but the indirection or obj[key] instead of obj.blah. could eval to make a function that would get the name directly to make this benchmark look better, but as always, its just a benchmark so you need to profile your code :]
  • Loading branch information...
commit b165d9f49f8466e0b858ab6ed33c2235d21d5191 1 parent b64b5b6
@ratbeard authored
Showing with 26 additions and 4 deletions.
  1. +26 −1 test/flexyargs.js
  2. +0 −3  test/test.html
View
27 test/flexyargs.js
@@ -200,4 +200,29 @@ $(document).ready(function() {
-});
+});
+
+
+(function() {
+ var peeps = [];
+ for (var i=0; i<50; i++) peeps.push({name: 'dude', age: i});
+
+ JSLitmus.test('some() w/ iterator', function() {
+ _.some(peeps, function(peep){ return peep.age === 25 });
+ });
+
+ JSLitmus.test('any() w/ iterator', function() {
+ _.any(peeps, function(peep){ return peep.age === 25 });
+ });
+
+ JSLitmus.test('any() w/ key, prop', function() {
+ _.any(peeps, 'age', 25);
+ });
+
+
+ // JSLitmus.test('any() w/ key, prop', function() {
+ // _.select(peeps, 'age', 25);
+ // });
+
+
+})();
View
3  test/test.html
@@ -25,9 +25,6 @@ <h1 class="qunit-header">Underscore Speed Suite</h1>
<h2 class="qunit-userAgent">
A representative sample of the functions are benchmarked here, to provide
a sense of how fast they might run in different browsers.
- Each iteration runs on an array of 1000 elements.<br /><br />
- For example, the 'intersect' test measures the number of times you can
- find the intersection of two thousand-element arrays in one second.
</h2>
<br />
</body>
Please sign in to comment.
Something went wrong with that request. Please try again.