Giter Site home page Giter Site logo

solute / ultrajson Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ultrajson/ultrajson

2.0 19.0 0.0 507 KB

Ultra fast JSON decoder and encoder written in C. Includes Python reference integration

Home Page: http://www.esn.me

C++ 17.99% C 56.11% Python 25.89%

ultrajson's Introduction

UltraJSON is a fast and extendable JSON encoder and decoder written in pure C

Python bindings are available as the module ujson (through easy_install / pypi):
http://pypi.python.org/pypi/ujson/


Installation instructions:

1. Build the ultrajson library
In root directory of ultrajson.
Type: make

2. Build and install ujson Python extension (requires root)
Go to <root>/python
Type: python setup.py build install  

3. Run tests (as needed)
Type: python tests.py

Same instructions applies for Windows except that step 1) isn't necessary since
a prebuilt static library is included.

Preliminary benchmarks:

64-bit benchmarks Linux
Python 2.6.6 (r266:84292, Sep 15 2010, 16:22:56)
OS Version: Ubuntu 10.10
System Type: x64-based PC
Processor: Intel(R) Core(TM) i5-2300 CPU @ 2.80GHz
Total Physical Memory: 4096 MB

Array with 256 utf-8 strings:
ujson encode      : 2714.66499 calls/sec
simplejson encode : 1542.63718 calls/sec
cjson encode      : 132.23604 calls/sec

ujson decode      : 2079.17287 calls/sec
cjson decode      : 992.21602 calls/sec
simplejson decode : 278.92061 calls/sec

Medium complex object:
ujson encode      : 17849.80356 calls/sec
simplejson encode : 3524.32372 calls/sec
cjson encode      : 2967.34656 calls/sec

ujson decode      : 11685.87610 calls/sec
cjson decode      : 8206.67906 calls/sec
simplejson decode : 6549.99750 calls/sec

Array with 256 strings:
ujson encode      : 38543.50303 calls/sec
simplejson encode : 19436.45772 calls/sec
cjson encode      : 12392.55614 calls/sec

ujson decode      : 27207.33157 calls/sec
cjson decode      : 30237.60827 calls/sec
simplejson decode : 25271.93073 calls/sec

Array with 256 doubles:
ujson encode      : 6027.45931 calls/sec
simplejson encode : 2915.54871 calls/sec
cjson encode      : 3546.88804 calls/sec

ujson decode      : 28045.13375 calls/sec
cjson decode      : 15066.73209 calls/sec
simplejson decode : 15604.98222 calls/sec

Array with 256 True values:
ujson encode      : 187342.39634 calls/sec
simplejson encode : 48972.93887 calls/sec
cjson encode      : 67274.93082 calls/sec

ujson decode      : 158103.79663 calls/sec
cjson decode      : 83237.88990 calls/sec
simplejson decode : 115645.98241 calls/sec

Array with 256 dict{string, int} pairs:
ujson encode      : 25301.85690 calls/sec
simplejson encode : 5734.29472 calls/sec
cjson encode      : 4447.73411 calls/sec

ujson decode      : 16290.72288 calls/sec
cjson decode      : 12528.56060 calls/sec
simplejson decode : 10394.23358 calls/sec

Dict with 256 arrays with 256 dict{string, int} pairs:
ujson encode      : 87.40865 calls/sec
simplejson encode : 17.07889 calls/sec
cjson encode      : 17.25164 calls/sec

ujson decode      : 45.94026 calls/sec
cjson decode      : 34.60225 calls/sec
simplejson decode : 26.92238 calls/sec

32-bit benchmarks Windows
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
OS Version: 6.1.7601 Service Pack 1 Build 7601
System Type: x64-based PC
Processor: Intel(R) Core(TM)2 Quad CPU Q9550 @ 2.83GHz 2.83 GHz
Total Physical Memory: 8191 MB

Array with 256 utf-8 strings:
ujson encode      : 1191.98175 calls/sec
simplejson encode : 1013.98279 calls/sec
cjson encode      : 1040.66063 calls/sec

ujson decode      : 1215.66875 calls/sec
cjson decode      : 493.30484 calls/sec
simplejson decode : 269.85512 calls/sec

Medium complex object:
ujson encode      : 10307.63723 calls/sec
simplejson encode : 2534.94769 calls/sec
cjson encode      : 2047.95118 calls/sec

ujson decode      : 7274.10026 calls/sec
cjson decode      : 3575.39307 calls/sec
simplejson decode : 3565.51252 calls/sec

Array with 256 strings:
ujson encode      : 21348.25210 calls/sec
simplejson encode : 15736.74638 calls/sec
cjson encode      : 6371.26334 calls/sec

ujson decode      : 26050.25316 calls/sec
cjson decode      : 16468.88215 calls/sec
simplejson decode : 21115.75770 calls/sec

Array with 256 doubles:
ujson encode      : 26975.49110 calls/sec
simplejson encode : 2046.29746 calls/sec
cjson encode      : 2133.56594 calls/sec

ujson decode      : 28430.33722 calls/sec
cjson decode      : 4114.36400 calls/sec
simplejson decode : 4419.08507 calls/sec

Array with 256 True values:
ujson encode      : 89846.12897 calls/sec
simplejson encode : 34288.36862 calls/sec
cjson encode      : 47168.35849 calls/sec

ujson decode      : 99423.47549 calls/sec
cjson decode      : 58795.91460 calls/sec
simplejson decode : 76296.14699 calls/sec

Array with 256 dict{string, int} pairs:
ujson encode      : 14776.41614 calls/sec
simplejson encode : 3876.86634 calls/sec
cjson encode      : 3050.65343 calls/sec

ujson decode      : 12934.39432 calls/sec
cjson decode      : 7993.04345 calls/sec
simplejson decode : 7152.09475 calls/sec

See (python/benchmark.py) for further information.

NOTE: These benchmarks are preliminary! 

ultrajson's People

Contributors

mbra avatar

Stargazers

Gerhard Scheffler avatar  avatar

Watchers

Johannes Knopp avatar Christian Schramm avatar Jonathan Oberländer avatar  avatar Sven Hoth avatar  avatar James Cloos avatar  avatar Marc Schmitzer avatar Arne Jans avatar  avatar Gunter Bach avatar Michael Hauck avatar Jan Morlock avatar luitzifa avatar Herp Derp 1337 avatar  avatar Christian Steimel 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.