node.js - use async auto as wrapper -
my synchronous code near thousand of lines. want divide them groups , put in async.auto (one group 1 function in async.auto). each function has name. because want make easy other people maintain in future. code divide group easy understand. want know async.auto cause performance loss comparing when don't use
do stuff; stuff; stuff; ... stuff;
i want change below:
async.auto({ do_a: function(cb){ stuff; stuff; }, do_b: ['do_a', function(cb, result){ stuff result; stuff result; }] }, function(err, result){ })
you should able divide , put separate functions async.auto large blocks of synchronous code there lot of coupling between different sections of code without realising. advice split up, testing each time create new group , commit change scm (e.g. git) before beginning next change. way when discover problems can go , find out introduced it.
i don't know enough performance impact would think minimal. best bet (as performance question) test in profiler. won't performance benefits either unless let run of functions out of order. if every block depends on previous 1 run in sequence.
Comments
Post a Comment