Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add generators and delegated generators benchmarks #43

Merged
merged 1 commit into from
Nov 10, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function fun(done) {
}

function *gen() {

}

function getPromise(val, err) {
Expand All @@ -19,8 +19,8 @@ function getPromise(val, err) {
}

suite('co()', function(){
set('mintime', 1000)
set('mintime', process.env.MINTIME | 0 || 1)

bench('promises', function(done){
co(function *(){
yield getPromise(1);
Expand All @@ -43,6 +43,22 @@ suite('co()', function(){
})(done);
})

bench('generators', function(done){
co(function *(){
yield gen();
yield gen();
yield gen();
})(done);
})

bench('generators delegated', function(done){
co(function *(){
yield* gen();
yield* gen();
yield* gen();
})(done);
})

bench('generator functions', function(done){
co(function *(){
yield gen;
Expand Down