News for hackers. Stuff that matters.
Re:Non-Blocking Asynchronous JSON.parse Using the Fetch API by davej on Friday July 31, 2015 @05:58AM (#9980853)
My results on Chrome 43 running on an i7 Macbook Pro. JSON generated from: http://beta.json-generator.com/NJG1eN49

~34KB json string (1st run):

    sync: total time (blocking): 0.412ms
    async: blocking time: 1.822ms
    async: total time: 3.943ms
    ➜ str.length
    34527
~34KB json string (10th run):

    sync: total time (blocking): 0.569ms
    async: blocking time: 0.438ms
    async: total time: 2.336ms
~112KB json string (1st run):

    sync: total time (blocking): 1.217ms
    async: blocking time: 1.036ms
    async: total time: 4.818ms
    ➜ str.length
    114745
~112KB json string (10th run):

    sync: total time (blocking): 1.658ms
    async: blocking time: 0.683ms
    async: total time: 4.444ms
Could do with some proper benchmarking by someone who knows more about benchmarking this stuff for real-world usage (i.e.. not me). By the way the 2nd - 10th run results were pretty similar, the amount of time that async function was blocking gradually decreased as it was run more often (I ran the ~34KB tests first).

There are no comments on this comment yet.