Home > async_vs_serial

async_vs_serial

Async_vs_serial is a project mainly written in JavaScript, it's free.

simple node.js program to show difference between default async and sequential serial processing

async_vs_serial    

Simple Node.js program to compare async default processing with serialised processing

For serial / sequential processing, a list of work functions is provided, each calling next
The implementation of next takes the frontmost work function off the list and executes it

Handy for database processing where sequence needs to be preserved
Simple enough to illustrate the async nature of Node.js

Sample output :

Default run

    > time ./async_vs_serial.js async

    RUNNING ASYNC
    >aaa
    >bbb
    >ccc
    <bbb took 50ms
    <ccc took 120ms
    <aaa took 220ms

    real    0m0.325s
    user    0m0.090s
    sys 0m0.012s

Serial run

    > time ./async_vs_serial.js serial

    RUNNING SERIAL
    >aaa
    <aaa took 220ms
    >bbb
    <bbb took 51ms
    >ccc
    <ccc took 120ms

    real    0m0.479s
    user    0m0.075s
    sys 0m0.011s

blog : quantblog.wordpress.com         
Previous:SF311-Facebook