Repository navigation
Releases
Releases · fox1245/neojson
neojson v0.1.0
neojson v0.1.0
Initial public release of neojson — an nlohmann::ordered_json-compatible C++17 JSON library combining native x86-64 AVX2 and ARM64 NEON SIMD parsers, a vendored yyjson fallback, and a lazy Copy-on-Write DOM.
Highlights
- Native AVX2 / NEON / SWAR Parsers + Pooled Buffers: Native x86-64 AVX2 (
Avx2ParserOps) and ARM64 NEON (NeonParserOps) SIMD parser backends with Keiser-Lemire UTF-8 validation, Eisel-Lemire float conversion, SWAR 8-digit integer/fractional parsing, and bounded thread-local buffer caching (ThreadLargeCache,ThreadSlabCache), falling back seamlessly to vendoredyyjsonon unsupported targets and small/comment/BOM inputs. - Lazy Copy-on-Write DOM &
DocArenaViews:sizeof(neojson::json) == 16, atomic-refcountedSharedStringpayloads, bump-allocatedDocArenaimmutable const views with shape caching (ArenaShapeCache) and string interning, compactSmallArray2/SmallObject4/CompactObjectlayouts, open-addressedordered_mapindexing (HashIndex), and iterative deep destruction. - Fused Single-Pass Direct Serializer: Streams unmaterialized unique-key subtrees directly into a pre-reserved
std::stringwithAVX2/SSE2/NEON/scalar UTF-8 validation and escape scanning, plus Schubfach shortest round-trip IEEE-754 formatting. - Safety & Production Controls: Configurable
json::parse_options::max_depth(default1100), thread-local cache budgets (get_thread_cache_limits(),set_thread_cache_limits(),trim_thread_caches()), differential tests againstnlohmann/json, time-complexity bounds tests, and runnable C++17 examples underexamples/. - Packaging & CMake /
pkg-configSupport:- Public
NEOJSON_VERSION_MAJOR(0),NEOJSON_VERSION_MINOR(1),NEOJSON_VERSION_PATCH(0), andNEOJSON_VERSION_STRING("0.1.0") macros. find_package(neojson 0.1 CONFIG REQUIRED), relocatableneojson.pc(pkg-config),FetchContent/add_subdirectorysubproject defaults (NEOJSON_BUILD_TESTS,NEOJSON_BUILD_EXAMPLES,NEOJSON_INSTALLdefault toOFFwhen embedded),BUILD_SHARED_LIBSsupport on ELF/Mach-O (STATICon Windows), and hidden vendoredyyjsonsymbols.
- Public
Benchmark Summary (7.94 MB Standard 4-File Corpus)
Single-thread throughput vs 6 established C/C++ JSON libraries (GCC 13.3.0 -O3 -DNDEBUG, portable Release without -march=native):
| Architecture | Workload | neojson |
vs yyjson (C) |
vs simdjson (DOM) |
vs nlohmann::ordered_json |
|---|---|---|---|---|---|
| x86-64 AVX2 | Parse (4 files) | 2,575 MB/s (3.08 ms) |
1.85× | 1.45× | 31.1× |
| Parse + Full Read | 1,539 MB/s (5.16 ms) |
1.29× | 1.10× | 19.0× | |
| Write (Minified) | 2,783 MB/s (2.85 ms) |
1.54× | 1.74× | 8.7× | |
Field Lookup (twitter.json) |
165.7 K/s (6.03 µs) |
1.71× | 2.17× | 1.33× | |
| ARM64 NEON | Parse (4 files) | 1,885 MB/s (4.21 ms) |
1.65× | 1.61× | 34.5× |
| Parse + Full Read | 1,155 MB/s (6.87 ms) |
1.19× | 1.19× | 21.7× | |
| Write (Minified) | 1,918 MB/s (4.14 ms) |
1.44× | 1.78× | 7.3× | |
Field Lookup (twitter.json) |
123.9 K/s (8.07 µs) |
1.26× | 1.95× | 1.16× |
See docs/benchmarks.md for the complete 7-library tables, per-file breakdowns, charts, and reproduction instructions.
Installation
CMake FetchContent
include(FetchContent)
FetchContent_Declare(
neojson
GIT_REPOSITORY https://github.com/fox1245/neojson.git
GIT_TAG v0.1.0
)
FetchContent_MakeAvailable(neojson)
target_link_libraries(my_app PRIVATE neojson::neojson)System Install + find_package
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DNEOJSON_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build --parallel
cmake --install buildSee README.md and CHANGELOG.md for compatibility notes (array_t/object_t allocator types, lazy/COW const reference stability, Schubfach float formatting).