Skip to content

Document why this is better than yield array #8

Description

@fzaninotto

Why is co-parallel better than simply yielding an array within co? I can't find any documentation about that, and my tests don't show any particular advantage:

// tasks is an array of 200 async tasks simulated by setTimeout, cf #3
var start = Date.now();
yield parallel(tasks, 10);
console.log('total used %dms', Date.now() - start);

This takes 170ms on average, while:

// tasks is an array of 200 async tasks simulated by setTimeout, cf #3
var start = Date.now();
yield tasks;
console.log('total used %dms', Date.now() - start);

This takes 117ms on average

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions