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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -