en	= Comparison to Other Libraries
zh-hans	= 与其他库的比较

en	:icon_good: pass:q[[.green]##&#10004##] :icon_bad: pass:q[[.red]##&#10008##]
zh-hans	:icon_good: pass:q[[.green]##✔##] :icon_bad: pass:q[[.red]##✘##]

en	There exist many C++ JSON libraries, but two are particularly noteworthy for the purpose of comparison: https://rapidjson.org/[RapidJSON], https://nlohmann.github.io/json/[JSON for Modern {cpp}] (referred to herein as nlohmann's JSON, or nlohmann), and https://github.com/lemire/simdjson[SIMD JSON].
zh-hans	C++ 中存在众多 JSON 库，但为了比较的目的，有三个在对比中尤为值得关注：https://rapidjson.org/[RapidJSON]、https://nlohmann.github.io/json/[JSON for Modern {cpp}]（本文中称为 nlohmann's JSON， 或简称 nlohmann）以及https://github.com/lemire/simdjson[SIMD JSON]。

en	Comparison to nlohmann JSON
zh-hans	与nlohmann JSON的比较

en	Value Type: https://github.com/nlohmann/json/blob/00cb98a3d170161711ab912ae6acefba31f29f75/include/nlohmann/json.hpp#L165[`nlohmann::basic_json`]
zh-hans	值类型：https://github.com/nlohmann/json/blob/00cb98a3d170161711ab912ae6acefba31f29f75/include/nlohmann/json.hpp#L165[`nlohmann::basic_json`]

en	This library adopts a "kitchen sink" approach. It contains a wealth of features, even those with niche uses. Its weakness is that the many template parameters, while allowing for configurability, inhibit the best possible optimizations. The consequence is that the library performs poorly. The ability to configure every aspect of the value type has the paradoxical effect of making it less suitable as a vocabulary type.
zh-hans	该库采用了一种“大而全”（kitchen sink）的设计理念，包含大量功能，甚至涵盖一些使用场景非常小众的特性。其弱点在于：尽管众多模板参数提供了高度可配置性，却阻碍了编译器实现最优的性能优化。其结果是性能表现较差。这种对值类型各方面均可配置的能力，反而使其作为通用类型的适用性降低，形成了一种悖论效应。

en	{icon_bad} `basic_json` is a class template. Libraries must agree on the
zh-hans	{icon_bad} `basic_json` 是一个类模板。各库必须在

en	choices of template parameters to be interoperable.
zh-hans	模板参数的选择上达成一致，这样才能实现互操作。

en	{icon_bad} Too much customization. We struggle to see a use case for making
zh-hans	{icon_bad} 过度定制化。我们很难想象

en	`BooleanType` anything other than `bool`.
zh-hans	将 `BooleanType` 设置为 `bool` 之外的其他类型的使用场景。

en	{icon_bad} Poor separation of concerns. The `basic_json` container
zh-hans	{icon_bad} 关注点分离不佳。`basic_json` 容器

en	declaration needlessly conflates parsing and serialization APIs.
zh-hans	声明不必要地将解析和序列化API混杂在一起。

en	{icon_bad} Limited allocator support. Only stateless allocators are allowed,
zh-hans	{icon_bad} 分配器支持有限。只允许无状态分配器，

en	which rules out the most important type of allocator, a local arena-based implementation.
zh-hans	这排除了最重要的一类分配器，即基于本地内存池的实现。

en	{icon_bad} No incremental parsing, no incremental serialization.
zh-hans	{icon_bad} 没有增量式解析，也没有增量式序列化。

en	{icon_bad} Slow parsing and serialization performance.
zh-hans	{icon_bad} 解析和序列化性能较差。

en	{icon_good} Full-featured, including JSON Pointer, CBOR, and others.
zh-hans	{icon_good} 功能全面，包含 JSON Pointer、CBOR 等特性。

en	Comparison to RapidJSON
zh-hans	与RapidJSON的比较

en	Value Type: https://github.com/Tencent/rapidjson/blob/bb5f966b9939d6cdfbac3462a0410e185099b3af/include/rapidjson/document.h#L608[`rapidjson::GenericValue`]
zh-hans	值类型：https://github.com/Tencent/rapidjson/blob/bb5f966b9939d6cdfbac3462a0410e185099b3af/include/rapidjson/document.h#L608[`rapidjson::GenericValue`]

en	{icon_bad} The value type is not regular. Assignment is destructive,
zh-hans	{icon_bad} 值类型不满足“正规性”要求。赋值具有破坏性，

en	performing `a = b` is equivalent to `a = std::move(b)`. No copy construction or copy assignment allowed.
zh-hans	执行 `a = b` 等同于 `a = std::move(b)`，且不允许复制构造和复制赋值。

en	{icon_bad} Object types have no hash table or index to reduce the cost of
zh-hans	{icon_bad} 对象类型没有哈希表或索引用于降低查找成本。

en	lookups.
zh-hans	(查找。)

en	{icon_bad} Allocators have reference semantics. Problems with lifetime are
zh-hans	{icon_bad} 分配器采用引用语义，容易引发生命周期问题。

en	easily encountered.
zh-hans	（容易引发。）

en	{icon_bad} The interface of the array and object types are considerably
zh-hans	{icon_bad} 数组和对象类型的接口

en	different from their standard library equivalents, and not idiomatic.
zh-hans	与标准库中的对应类型差异显著，且不符合惯用法。

en	{icon_bad} No incremental parsing, no incremental serialization.
zh-hans	{icon_bad} 没有增量式解析，也没有增量式序列化。

en	{icon_good} Parsing and serialization performance is better than most other
zh-hans	{icon_good} 解析和序列化性能优于大多数其他。

en	libraries.
zh-hans	库。

en	Comparison to SIMD JSON
zh-hans	与SIMD JSON的比较

en	This is quite an interesting data structure, which is optimized to work well with the SIMD parser. It makes very good design choices for the intended use-case. However it is not well suited as a vocabulary type due to the necessary limitations.
zh-hans	这是一种相当有趣的数据结构，专为与 SIMD 解析器协同工作而优化。它在目标使用场景下做出了非常优秀的设计选择。然而，由于其必要的限制，它不太适合作为通用类型。

en	{icon_bad} Sequential access only, via `ParsedJson::BasicIterator`
zh-hans	{icon_bad} 仅支持通过 `ParsedJson::BasicIterator` 进行顺序访问

en	{icon_bad} Read-only, can only be populated by the provided SIMD JSON parser.
zh-hans	{icon_bad} 为只读类型，仅能通过所提供的 SIMD JSON 解析器进行填充。

en	{icon_good} The fastest available JSON parser.
zh-hans	{icon_good} 为目前最快的JSON解析器。