benckmarking the known problem of blocking JSON.stringify, a common bottleneck for NodeJS programs

in #nodejs5 years ago (edited)

cpu benchmark on JSON.stringify and its alternatives.

use code from https://github.com/CLDH214/cpu-benchmark.

A 524.288019 MB JSON string takes up to 100% CPU on my 3.5 GHz Quad-Core Intel Core i5
when it is being stringified with JSON.stringify.

A half sized (209.715219 MB) JSON string takes up to 100% CPU with the yieldable-json library too.

You can replicate normal JSON.stringify by

docker build -t sugar/cpu-benchmark .
docker run sugar/cpu-benchmark:latest
docker stats

You can replicate yieldable-json by

  • (make sure your toggle the Docker>preferences>Advanced memory section to be larger than 8GB first)
docker build -f Dockerfile-yieldable -t sugar/cpu-benchmark-yieldable .
docker run -m=8g sugar/cpu-benchmark-yieldable:latest
docker stats
Sort:  

Congratulations @guesshu! You received a personal award!

Happy Steem Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Vote for @Steemitboard as a witness to get one more award and increased upvotes!