GithubHelp home page GithubHelp logo

ezhangle / yajl_vs_rapidjson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lloyd/yajl_vs_rapidjson

0.0 2.0 0.0 1.2 MB

quick and dirty performance comparison of two json parsers.

Batchfile 0.05% Lua 2.21% C++ 97.42% C 0.32%

yajl_vs_rapidjson's Introduction

A quick and dirty comparison of rapidjson vs yajl for pretty printing of JSON.

compiling rapidjson:

$ cd rapidjson/examples/pretty
$ g++ -O3 -o pretty -I rapidjson/include rapidjson/example/pretty/pretty.cpp

just get json_reformat from the yajl package from your package management system.

Comparison of pretty printing for test_file.json:

[lth@lloydpro rapidjson_vs_yajl]$ time json_reformat < test_file.json  > /dev/null
real          0m0.119s
user          0m0.113s
sys           0m0.004s
[lth@lloydpro rapidjson_vs_yajl]$ time ./pretty < test_file.json  > /dev/null
real          0m0.175s
user          0m0.168s
sys           0m0.005s
[lth@lloydpro rapidjson_vs_yajl]$ time cat < test_file.json > /dev/null
real          0m0.006s
user          0m0.001s
sys           0m0.005s

Comparison of pretty printing for test_file2.json:

[lth@lloydpro rapidjson_vs_yajl]$ time ./pretty < test_file2.json  > /dev/null
real          0m0.119s
user          0m0.113s
sys           0m0.005s
[lth@lloydpro rapidjson_vs_yajl]$ time json_reformat < test_file2.json  > /dev/null
real          0m0.105s
user          0m0.099s
sys           0m0.004s
[lth@lloydpro rapidjson_vs_yajl]$ time cat < test_file2.json > /dev/null
real          0m0.006s
user          0m0.001s
sys           0m0.004s

Conclusion:

For pretty printing, on osx 10.7, for these two data files, YAJL is 31% faster than rapidjson.

math: (/ (+ (- (/ 113 99.0) 1) (- (/ 168 113.0) 1)) 2.0)

Oh. and cat is a couple orders of magnitude faster than either.

UPDATE: on 64 bit arch linux, yajl is ~80% faster using the same methodology.

yajl_vs_rapidjson's People

Contributors

lloyd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.