Giter VIP home page Giter VIP logo

lfjson's Introduction

Light-foot JSON

A memory-optimized and data-oriented JSON library written in C++.

Includes benchmarks and Google Test support.

Features

  • 16-Bytes JSON values (12 on x86)
  • 24-Bytes JSON members (16 on x86)
  • Short string optimization up to 14 characters (10 on x86)
  • Specialized array types for bool, int64_t and double
  • Custom StringPool for string deduplication
    • based on an optimized intrusive hash table
    • shareable for easy reuse on consecutive parsing
    • with zero-copy support for const strings
  • Allocator-aware PoolAllocator for memory management
    • designed as a slab allocator with dead-cells recycling
    • composable with Heap and StackAllocator
  • Fast and easy-to-use reference-based API

Notes

This library doesn't include a JSON parser and relies on external 3rd-party for this purpose. RapidJSON is integrated as a default backend to demonstrate usage in the benchmark example.

Benchmark results

Benchmark configuration:

  • Platform: Windows 10 64-bits, i7-10875h
  • 3rd-parties: xxHash 0.8.1, RapidJSON 1.1.0
  • Compiler: MinGW 8.1, -O2 -DNDEBUG

Notes:

  • Memory benchmarks were done with default chunk size for both libraries (RapidJSON: 65K, LFJSON: 2*32K)
  • Speed benchmarks were done with MinGW-64 on Windows 10. Results may vary depending on platform/compiler.

RelativeMem_x64 RelativeMem_x86 RelativeSpeed_Deserialize RelativeSpeed_Serialize

Dependencies

This project uses git submodule to include Google Test repository:

$ git clone https://github.com/gaujay/lfjson.git
$ cd lfjson
$ git submodule init && git submodule update

LFJSON also uses xxHash as an optional 3rd-party to speed up its StringPool hashing requirements. To disable this dependency, just set the flag LFJ_NO_XXHASH.

Building

Support GCC/MinGW and MSVC (see 'CMakeLists.txt').

You can open 'CMakeLists.txt' with a compatible IDE or use command line:

$ mkdir build
$ cd build
$ cmake ..
$ make <target> -j

License

LFJSON - Apache License 2.0

xxHash - BSD 2-Clause License

RapidJSON - MIT License + 3rd-parties

lfjson's People

Contributors

gaujay avatar

Watchers

 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.