Benchmark JSON streaming serialization performance.
Short story: JSON Streaming performance sucks, now you know, lets make it better.
If you scroll down to throughput you'll see the bigger picture. Streaming is an order of magnitude worse than simply doing it via built-in JSON stringify/parse.
Updated to use Node v4.2.2 and leverage setImmediate for delayed tests for more real-world data
* Throughput (KByte/sec):
JSON 2907899 (base)
Numerics.read 132408 (base)
Numerics.write 133939 (base)
Mixed Types.read 179108 (base)
Mixed Types.write 123024 (base)
Heavy Nesting.read 131381 (base)
Heavy Nesting.write 173503 (base)
Huge Complex.read 668969 (base)
Huge Complex.write 920568 (base)
Huge (1MB) Buffer.read 399872 (base)
Huge (1MB) Buffer.write 45127 (base)
JSON-delay 2395944 (82%)
Numerics.read 39195 (30%)
Numerics.write 40198 (30%)
Mixed Types.read 51081 (29%)
Mixed Types.write 45850 (37%)
Heavy Nesting.read 108338 (82%)
Heavy Nesting.write 134913 (78%)
Huge Complex.read 659921 (99%)
Huge Complex.write 875100 (95%)
Huge (1MB) Buffer.read 396362 (99%)
Huge (1MB) Buffer.write 44986 (100%)
JSONStream 513910 (18%)
Numerics.read 9909 (7%)
Numerics.write 12316 (9%)
Mixed Types.read 13182 (7%)
Mixed Types.write 17197 (14%)
Heavy Nesting.read 51557 (39%)
Heavy Nesting.write 33600 (19%)
Huge Complex.read 138899 (21%)
Huge Complex.write 136379 (15%)
Huge (1MB) Buffer.read 95302 (24%)
Huge (1MB) Buffer.write 5569 (12%)
JSONStream-delay 518151 (18%)
Numerics.read 7381 (6%)
Numerics.write 11128 (8%)
Mixed Types.read 10037 (6%)
Mixed Types.write 12393 (10%)
Heavy Nesting.read 46530 (35%)
Heavy Nesting.write 31099 (18%)
Huge Complex.read 159335 (24%)
Huge Complex.write 164902 (18%)
Huge (1MB) Buffer.read 69521 (17%)
Huge (1MB) Buffer.write 5825 (13%)
* CPU Clock (ms): *** NOTE: Includes all cpu usage -- run only on idle system
JSON 37360 (base)
Numerics.read 3380 (base)
Numerics.write 3770 (base)
Mixed Types.read 3340 (base)
Mixed Types.write 3500 (base)
Heavy Nesting.read 4040 (base)
Heavy Nesting.write 3440 (base)
Huge Complex.read 3990 (base)
Huge Complex.write 3940 (base)
Huge (1MB) Buffer.read 3800 (base)
Huge (1MB) Buffer.write 4160 (base)
JSON-delay 35690 (96%)
Numerics.read 3970 (117%)
Numerics.write 3840 (102%)
Mixed Types.read 3490 (104%)
Mixed Types.write 4020 (115%)
Heavy Nesting.read 3310 (82%)
Heavy Nesting.write 3350 (97%)
Huge Complex.read 3290 (82%)
Huge Complex.write 3570 (91%)
Huge (1MB) Buffer.read 3400 (89%)
Huge (1MB) Buffer.write 3450 (83%)
JSONStream 38180 (102%)
Numerics.read 3370 (100%)
Numerics.write 3760 (100%)
Mixed Types.read 3340 (100%)
Mixed Types.write 3470 (99%)
Heavy Nesting.read 4190 (104%)
Heavy Nesting.write 3750 (109%)
Huge Complex.read 3930 (98%)
Huge Complex.write 3690 (94%)
Huge (1MB) Buffer.read 3730 (98%)
Huge (1MB) Buffer.write 4950 (119%)
JSONStream-delay 37350 (100%)
Numerics.read 3910 (116%)
Numerics.write 3800 (101%)
Mixed Types.read 3690 (110%)
Mixed Types.write 3740 (107%)
Heavy Nesting.read 3810 (94%)
Heavy Nesting.write 3930 (114%)
Huge Complex.read 3800 (95%)
Huge Complex.write 3670 (93%)
Huge (1MB) Buffer.read 3450 (91%)
Huge (1MB) Buffer.write 3550 (85%)
* Avg Event Lag (ms):
JSON 31 (base)
Numerics.read 31 (base)
Numerics.write 31 (base)
Mixed Types.read 31 (base)
Mixed Types.write 31 (base)
Heavy Nesting.read 31 (base)
Heavy Nesting.write 31 (base)
Huge Complex.read 31 (base)
Huge Complex.write 31 (base)
Huge (1MB) Buffer.read 31 (base)
Huge (1MB) Buffer.write 33 (base)
JSON-delay 5 (16%)
Numerics.read 1 (3%)
Numerics.write 1 (3%)
Mixed Types.read 1 (3%)
Mixed Types.write 1 (3%)
Heavy Nesting.read 1 (3%)
Heavy Nesting.write 1 (3%)
Huge Complex.read 1 (3%)
Huge Complex.write 1 (3%)
Huge (1MB) Buffer.read 13 (42%)
Huge (1MB) Buffer.write 27 (82%)
JSONStream 33 (106%)
Numerics.read 34 (110%)
Numerics.write 37 (119%)
Mixed Types.read 33 (106%)
Mixed Types.write 37 (119%)
Heavy Nesting.read 33 (106%)
Heavy Nesting.write 32 (103%)
Huge Complex.read 31 (100%)
Huge Complex.write 31 (100%)
Huge (1MB) Buffer.read 31 (100%)
Huge (1MB) Buffer.write 35 (106%)
JSONStream-delay 7 (23%)
Numerics.read 1 (3%)
Numerics.write 1 (3%)
Mixed Types.read 1 (3%)
Mixed Types.write 1 (3%)
Heavy Nesting.read 1 (3%)
Heavy Nesting.write 1 (3%)
Huge Complex.read 1 (3%)
Huge Complex.write 1 (3%)
Huge (1MB) Buffer.read 26 (84%)
Huge (1MB) Buffer.write 31 (94%)