forked from canjs/canjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added benchmark.js to measure performance improvements while investig…
…ating canjs#595
- Loading branch information
1 parent
104e6ef
commit adb6af4
Showing
8 changed files
with
126 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
</head> | ||
<body> | ||
<h1 id="qunit-header">can.Map Test Suite</h1> | ||
|
||
<h2 id="qunit-banner"></h2> | ||
|
||
<div id="qunit-testrunner-toolbar"></div> | ||
<h2 id="qunit-userAgent"></h2> | ||
<ol id="qunit-tests"></ol> | ||
<div id="qunit-test-area"></div> | ||
|
||
<script type="text/javascript" src="../lib/steal/steal.js?can/map/map_benchmark.js"></script> | ||
<script type="text/javascript"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
steal('can/map', 'can/list','can/test/benchmarks.js',function(Map, List, benchmarks){ | ||
|
||
benchmarks.add( | ||
"Adding a big array to an object", | ||
function(){ | ||
var map = new can.Map(), | ||
objects = []; | ||
|
||
for (var i = 0; i < 10; i++){ | ||
objects.push({prop: 'prop', nest: {prop: 'prop', nest: {prop: 'prop'}}}) | ||
} | ||
}, | ||
function(){ | ||
map.attr('obj', objects) | ||
}); | ||
|
||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
steal("steal","benchmark", function(steal){ | ||
|
||
var suite = new Benchmark.Suite; | ||
|
||
suite.on('cycle', function(event) { | ||
console.log(String(event.target)); | ||
}) | ||
|
||
var benchmarks = { | ||
add: function(name, setup, benchmark){ | ||
if(!benchmark){ | ||
benchmark = setup; | ||
setup = undefined | ||
} | ||
suite.add(name, benchmark, { | ||
setup: setup | ||
}); | ||
return this; | ||
}, | ||
run: function(){ | ||
suite.run({ 'async': true, 'queued': true }); | ||
}, | ||
suite: suite, | ||
on: function(){ | ||
return suite.on.apply(this, arguments) | ||
} | ||
} | ||
steal.bind("done", function(){ | ||
benchmarks.run(); | ||
}) | ||
|
||
return benchmarks; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters