Merge branch develop into claude/perf-contiguous-parser
Resolve the conflict in docs/mkdocs/docs/features/files.md (keep the measured ifstream ratio of this PR, use develop's json_view/index.md link) and regenerate the single include headers. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
No files matched your search
@@ -50,7 +50,7 @@ Besides `basic_json`, the library offers a second way to hold a parsed JSON text
|
||||
[`basic_json_document`](../basic_json_document/index.md), which owns or borrows the text and holds a flat index of the
|
||||
values in it, and a [`basic_json_view`](../basic_json_view/index.md), a read-only handle to one value of such a document.
|
||||
Both are defined in the header `<nlohmann/json_view.hpp>`; see
|
||||
[Zero-copy JSON views](../../features/json_view.md) for the concept and the trade-offs.
|
||||
[Zero-copy JSON views](../../features/json_view/index.md) for the concept and the trade-offs.
|
||||
|
||||
- [**json_document**](../json_document.md) / [**ordered_json_document**](../ordered_json_document.md) - read-only
|
||||
documents of the `basic_json` specialization they belong to
|
||||
@@ -363,7 +363,7 @@ Access to the JSON value
|
||||
specification of the JSON data interchange format
|
||||
- [`basic_json_document`](../basic_json_document/index.md) - / [`basic_json_view`](../basic_json_view/index.md) - parse a JSON
|
||||
text into a flat index and read it through a view
|
||||
- [Zero-copy JSON views](../../features/json_view.md) - when to use a document and a view instead of a `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md) - when to use a document and a view instead of a `basic_json`
|
||||
- [Types](../../features/types/index.md) - how JSON values are stored and which types exist
|
||||
- [Converting values](../../features/conversions.md) - get values out of a JSON value and put values in
|
||||
- [Creating JSON values](../../features/creating_values.md) - all the ways to build a JSON value
|
||||
|
||||
@@ -124,7 +124,7 @@ outside of a string, invalid) byte; see the [FAQ entry](../../home/faq.md#nul-by
|
||||
[`basic_json_document::parse`](../basic_json_document/parse.md) accepts the same inputs and the same options, but
|
||||
keeps the result as a flat index of the parsed values instead of a tree of `basic_json` values. It is faster and uses
|
||||
less memory when only parts of the document are read, and it also accepts a pointer to a null-terminated wide string,
|
||||
which `parse()` does not. See [Zero-copy JSON views](../../features/json_view.md).
|
||||
which `parse()` does not. See [Zero-copy JSON views](../../features/json_view/index.md).
|
||||
|
||||
!!! tip "Performance"
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ compile; see [`parse`](parse.md#notes).
|
||||
|
||||
- [`parse`](parse.md) - deserialize from a compatible input
|
||||
- [`BasicJsonType::accept`](../basic_json/accept.md) - the corresponding function of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#what-is-the-same-as-parse) - how parsing a document differs from, and matches, basic_json::parse
|
||||
- [Zero-copy JSON views](../../features/json_view/differences.md#what-is-the-same) - how parsing a document differs from, and matches, basic_json::parse
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ Constant.
|
||||
|
||||
- [`parse`](parse.md) - deserialize from a compatible input
|
||||
- [`is_discarded`](is_discarded.md) - return whether the last parse failed
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - who owns the source text and for how long
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - who owns the source text and for how long
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ by an erase, not only those at or after the removed element, since the container
|
||||
- [`root`](root.md) - the view of the root value, the starting point of overload 3
|
||||
- [`BasicJsonType::erase`](../basic_json/erase.md) - the corresponding function of `basic_json`
|
||||
- [Edits](index.md#edits) - what an edit guarantees, for every overload
|
||||
- [Zero-copy JSON views](../../features/json_view.md#editing-a-document) - what an edit guarantees and costs
|
||||
- [Zero-copy JSON views](../../features/json_view/editing.md) - what an edit guarantees and costs
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ points apply to every edit:
|
||||
anything `BasicJsonType` can be constructed from (numbers, strings, `#!cpp bool`, `#!cpp nullptr`, containers, ...).
|
||||
- [`dump()`](../basic_json_view/dump.md) writes an edited document with members in document order, new members at
|
||||
the end, and, with [`number_format::source`](../basic_json_view/number_format.md), keeps the spelling of every
|
||||
number that was not itself edited — see [Editing a document](../../features/json_view.md#editing-a-document) for
|
||||
number that was not itself edited — see [Editing a document](../../features/json_view/editing.md) for
|
||||
why this matters.
|
||||
- [`read()`](read.md) discards all edits, [`shrink_to_fit()`](shrink_to_fit.md) does not move the node index once
|
||||
there are edits, and [`memory_usage()`](memory_usage.md) includes the memory edits use.
|
||||
@@ -118,7 +118,7 @@ points apply to every edit:
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](../../features/json_view.md) - guide to documents and views
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md) - guide to documents and views
|
||||
- [`basic_json_view`](../basic_json_view/index.md) - the non-owning handle to a value in a document
|
||||
- [`json_document`](../json_document.md) - and [`json_editable_document`](../json_editable_document.md) - the default specializations
|
||||
- [`materialize`](../basic_json_view/materialize.md) - build a `basic_json` value from a view
|
||||
|
||||
@@ -108,7 +108,7 @@ an edit in general.
|
||||
- [`set`](set.md) - replace a value, or set an object member, an array element, or the value a JSON pointer refers to
|
||||
- [`BasicJsonType::insert`](../basic_json/insert.md) - the corresponding function of `basic_json`
|
||||
- [Edits](index.md#edits) - what an edit guarantees, for every overload
|
||||
- [Zero-copy JSON views](../../features/json_view.md#editing-a-document) - what an edit guarantees and costs
|
||||
- [Zero-copy JSON views](../../features/json_view/editing.md) - what an edit guarantees and costs
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ When the document is discarded, [`root()`](root.md) returns a discarded view (it
|
||||
|
||||
- [`parse`](parse.md) - deserialize from a compatible input
|
||||
- [`basic_json_view::is_discarded`](../basic_json_view/is_discarded.md) - return whether a view is invalid
|
||||
- [Zero-copy JSON views](../../features/json_view.md#what-is-the-same-as-parse) - how a discarded document arises
|
||||
- [Zero-copy JSON views](../../features/json_view/differences.md#what-is-the-same) - how a discarded document arises
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ static basic_json_document load(std::vector<std::uint8_t>&& image,
|
||||
|
||||
In every overload, the node index is copied into storage the document itself owns — so that it is properly aligned,
|
||||
and, for an [editable](index.md#edits) document, can be edited — while the text and the decoded strings stay in
|
||||
`image`. The hash indexes [large objects](../../features/json_view.md) use for lookup are rebuilt, exactly as after
|
||||
`image`. The hash indexes [large objects](../../features/json_view/index.md) use for lookup are rebuilt, exactly as after
|
||||
parsing.
|
||||
|
||||
## Parameters
|
||||
@@ -172,7 +172,7 @@ returned document, and any [view](../basic_json_view/index.md) taken from it, is
|
||||
- [`save`](save.md) - write the document as an image
|
||||
- [`owns_source`](owns_source.md) - return whether the document holds its own copy of the text
|
||||
- [`parse`](parse.md) - deserialize from JSON text instead of an image
|
||||
- [Images](../../features/json_view.md#images) - why and when to use images
|
||||
- [Images](../../features/json_view/images.md) - why and when to use images
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ to observe the effect of [`shrink_to_fit()`](shrink_to_fit.md).
|
||||
|
||||
- [`node_count`](node_count.md) - the number of index entries
|
||||
- [`shrink_to_fit`](shrink_to_fit.md) - release unused index capacity
|
||||
- [Zero-copy JSON views](../../features/json_view.md#the-idea) - the flat node index and its memory
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md#the-idea) - the flat node index and its memory
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ strings and, for an owned document, the text).
|
||||
|
||||
- [`memory_usage`](memory_usage.md) - the number of bytes held by the document
|
||||
- [`shrink_to_fit`](shrink_to_fit.md) - release unused index capacity
|
||||
- [Zero-copy JSON views](../../features/json_view.md#the-idea) - the flat node index and its memory
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md#the-idea) - the flat node index and its memory
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ document (`#!cpp owns_source() == false`) is only valid while the buffer it was
|
||||
- [`parse`](parse.md) - deserialize from a compatible input
|
||||
- [`parse_copy`](parse_copy.md) - deserialize a copy of a compatible input, always owned
|
||||
- [`source`](source.md) - the parsed text
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - who owns the source text and for how long
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - who owns the source text and for how long
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ told apart from other class-type iterators, so their range is read into an owned
|
||||
range (e.g. of a `#!cpp std::list<char>`).
|
||||
|
||||
See [`owns_source`](owns_source.md) to check which happened after a call, and the
|
||||
[feature page](../../features/json_view.md) for the reasoning.
|
||||
[feature page](../../features/json_view/index.md) for the reasoning.
|
||||
|
||||
**Numbers.** As for [`BasicJsonType::parse()`](../basic_json/parse.md), an integer literal too large for the 64-bit
|
||||
integer type becomes a floating-point value.
|
||||
|
||||
@@ -74,7 +74,7 @@ compile; see [`parse`](parse.md#notes).
|
||||
|
||||
- [`parse`](parse.md) - deserialize from a compatible input, borrowing it where possible
|
||||
- [`owns_source`](owns_source.md) - return whether the document holds its own copy of the text
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - borrowing or copying the source text
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - borrowing or copying the source text
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ Like [`set`](set.md) on a member or an element, `push_back` never moves an exist
|
||||
- [`root`](root.md) - the view of the root value
|
||||
- [`BasicJsonType::push_back`](../basic_json/push_back.md) - the corresponding function of `basic_json`
|
||||
- [Edits](index.md#edits) - what an edit guarantees, for every overload
|
||||
- [Zero-copy JSON views](../../features/json_view.md#editing-a-document) - what an edit guarantees and costs
|
||||
- [Zero-copy JSON views](../../features/json_view/editing.md) - what an edit guarantees and costs
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ compile; see [`parse`](parse.md#notes).
|
||||
- [`parse`](parse.md) - deserialize from a compatible input
|
||||
- [`root`](root.md) - the view of the root value
|
||||
- [`load`](load.md) - read a document from an image instead of parsing JSON text
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - reusing a document and what it invalidates
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - reusing a document and what it invalidates
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ auto v = doc.root();
|
||||
returned view is valid under the same conditions as any other view of the document — see
|
||||
[Object inspection](../basic_json_view/index.md) — in particular, it is invalidated by the next
|
||||
[`read()`](read.md) or [`shrink_to_fit()`](shrink_to_fit.md) on this document. A view can dangle, like a
|
||||
`#!cpp std::string_view`; see [Ownership and lifetime](../../features/json_view.md#ownership-and-lifetime).
|
||||
`#!cpp std::string_view`; see [Ownership and lifetime](../../features/json_view/lifetime.md).
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ big-endian reader could not interpret correctly.
|
||||
- [`load`](load.md) - read an image written by `save()`
|
||||
- [`owns_source`](owns_source.md) - return whether the document holds its own copy of the text
|
||||
- [`basic_json_view::dump`](../basic_json_view/dump.md) - serialize the document to JSON text instead of an image
|
||||
- [Images](../../features/json_view.md#images) - why and when to use images
|
||||
- [Images](../../features/json_view/images.md) - why and when to use images
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ one-node scalar.
|
||||
- [`basic_json_view::dump`](../basic_json_view/dump.md) - serialize the document, keeping an untouched number's
|
||||
spelling with `#!cpp number_format::source`
|
||||
- [Edits](index.md#edits) - what an edit guarantees, for every overload
|
||||
- [Editing a document](../../features/json_view.md#editing-a-document) - why editable documents keep the source
|
||||
- [Editing a document](../../features/json_view/editing.md) - why editable documents keep the source
|
||||
text's order and number spelling
|
||||
|
||||
## Version history
|
||||
|
||||
@@ -56,7 +56,7 @@ possible would be an internal optimization only, not a guarantee to rely on.
|
||||
- [`node_count`](node_count.md) - the number of index entries
|
||||
- [`memory_usage`](memory_usage.md) - the number of bytes held by the document
|
||||
- [`root`](root.md) - the view of the root value
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - what releasing memory invalidates
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - what releasing memory invalidates
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ is; see [`owns_source`](owns_source.md).
|
||||
|
||||
- [`owns_source`](owns_source.md) - return whether the document holds its own copy of the text
|
||||
- [`source_offset`](../basic_json_view/source_offset.md) - byte offset of a value in the source text
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - who owns the source text and for how long
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - who owns the source text and for how long
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ Pointer path of the value within the document, and with
|
||||
|
||||
If the source text repeats a key, this resolves to the *first* member with it, not to the last one that
|
||||
[`materialize()`](materialize.md) and `parse()` keep. See the [Notes on duplicate keys](operator[].md#notes) of
|
||||
`operator[]` and [Duplicate keys](../../features/json_view.md#duplicate-keys) for the reasons and for how to get
|
||||
`operator[]` and [Duplicate keys](../../features/json_view/differences.md#duplicate-keys) for the reasons and for how to get
|
||||
the last value.
|
||||
|
||||
Unlike [`operator[]`](operator[].md), which returns a [discarded](is_discarded.md) view for a missing key or an
|
||||
|
||||
@@ -58,7 +58,7 @@ placeholder for "no value yet" and later be assigned a real view.
|
||||
- [`is_discarded`](is_discarded.md) - return whether the view is invalid
|
||||
- [`root`](../basic_json_document/root.md) - the view of a document's root value
|
||||
- [`view_mode`](../view_mode.md) - whether a document and its views can be edited
|
||||
- [Zero-copy JSON views](../../features/json_view.md#ownership-and-lifetime) - how long a view stays valid
|
||||
- [Zero-copy JSON views](../../features/json_view/lifetime.md) - how long a view stays valid
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ No-throw guarantee: this function never throws exceptions.
|
||||
|
||||
If the source text repeats a key, this resolves to the *first* member with it, not to the last one that
|
||||
[`materialize()`](materialize.md) and `parse()` keep. See the [Notes on duplicate keys](operator[].md#notes) of
|
||||
`operator[]` and [Duplicate keys](../../features/json_view.md#duplicate-keys) for the reasons and for how to get
|
||||
`operator[]` and [Duplicate keys](../../features/json_view/differences.md#duplicate-keys) for the reasons and for how to get
|
||||
the last value.
|
||||
|
||||
Overload 1 always returns `#!cpp false` when the value is not an object — including a [discarded](is_discarded.md)
|
||||
|
||||
@@ -70,7 +70,7 @@ except that `#!cpp -0` is written as `#!cpp 0`, the way [`BasicJsonType::parse()
|
||||
`#!cpp number_format::source` copies every number exactly as written in the source text instead, with no exception
|
||||
for `#!cpp -0` — `#!cpp 1.50`, `#!cpp 1E2`, `#!cpp -0.0`, `#!cpp -0`, or all digits of an integer literal with more
|
||||
digits than any number type holds (such a literal is itself classified as a float, see
|
||||
[What is different](../../features/json_view.md#what-is-different)) — something `BasicJsonType` cannot do, since
|
||||
[What is different](../../features/json_view/differences.md)) — something `BasicJsonType` cannot do, since
|
||||
parsing already reduces every number to its parsed value.
|
||||
|
||||
## Examples
|
||||
@@ -98,7 +98,7 @@ parsing already reduces every number to its parsed value.
|
||||
- [`operator<<`](operator_ltlt.md) - serialize this value to a stream
|
||||
- [`materialize`](materialize.md) - build a `BasicJsonType` value, e.g. to use `BasicJsonType::dump`'s `error_handler`
|
||||
- [`BasicJsonType::dump`](../basic_json/dump.md) - the corresponding function of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#writing-a-view-back) - writing a view back without building a tree
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#writing-a-view-back) - writing a view back without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ constant time on average.
|
||||
|
||||
If the source text repeats a key, this resolves to the *first* member with it, not to the last one that
|
||||
[`materialize()`](materialize.md) and `parse()` keep. See the [Notes on duplicate keys](operator[].md#notes) of
|
||||
`operator[]` and [Duplicate keys](../../features/json_view.md#duplicate-keys) for the reasons and for how to get
|
||||
`operator[]` and [Duplicate keys](../../features/json_view/differences.md#duplicate-keys) for the reasons and for how to get
|
||||
the last value.
|
||||
|
||||
Unlike [`BasicJsonType::find`](../basic_json/find.md), which always returns `#!cpp end()` for a non-object type, this
|
||||
|
||||
@@ -39,14 +39,14 @@ as [`BasicJsonType::parse()`](../basic_json/parse.md) does), as well as the type
|
||||
accept views, e.g. with [`is_json_view`](../is_json_view.md). A `from_json()` that also accepts types that are no JSON
|
||||
values at all, such as the unconstrained `#!cpp template<typename BasicJsonType> void from_json(const BasicJsonType&,
|
||||
T&)` of [arbitrary type conversions](../../features/arbitrary_types.md), is not called with a view: it may use
|
||||
`BasicJsonType` functions a view does not have. See [Writing generic code](../../features/json_view.md#writing-generic-code).
|
||||
`BasicJsonType` functions a view does not have. See [Writing generic code](../../features/json_view/generic_code.md).
|
||||
|
||||
!!! warning "Duplicate keys"
|
||||
|
||||
Such a `from_json()` looks members up in the view, where a repeated key finds the **first** member, while
|
||||
`#!cpp materialize().get<T>()` sees the **last** one, as [`BasicJsonType::parse()`](../basic_json/parse.md)
|
||||
keeps it: for `#!cpp {"x":1,"x":2}`, `#!cpp get<point>()` reads `#!cpp x == 1`. See
|
||||
[Duplicate keys](../../features/json_view.md#duplicate-keys).
|
||||
[Duplicate keys](../../features/json_view/differences.md#duplicate-keys).
|
||||
|
||||
Every other `T` — user types whose `from_json()` is written for `BasicJsonType` only, types without a default
|
||||
constructor, `#!cpp std::tuple`s holding references, ... — is converted by `#!cpp materialize().get<T>()`: the subtree is built into a real `BasicJsonType`
|
||||
@@ -152,7 +152,7 @@ instead: its path is relative to the root of the view's subtree, because `materi
|
||||
- [`number_token`](number_token.md) - a number's token text, without a copy
|
||||
- [`materialize`](materialize.md) - build the `BasicJsonType` value of this subtree
|
||||
- [`BasicJsonType::get`](../basic_json/get.md) - the corresponding function of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#getting-values-out-without-copying) - which conversions avoid building a basic_json value
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#getting-values-out-without-copying) - which conversions avoid building a basic_json value
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ since floating-point values and unescaped strings are read from the source lazil
|
||||
- [`get`](get.md) - convert the value to a given type (`#!cpp get<string_view_t>()` is equivalent to this function)
|
||||
- [`number_token`](number_token.md) - a number's token text, without a copy
|
||||
- [`BasicJsonType::get_ref`](../basic_json/get_ref.md) - the closest counterpart of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#getting-values-out-without-copying) - borrowing strings instead of copying them
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#getting-values-out-without-copying) - borrowing strings instead of copying them
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ them with those of a default-constructed `T`.
|
||||
|
||||
- [`get`](get.md) - convert the value to a given type
|
||||
- [`BasicJsonType::get_to`](../basic_json/get_to.md) - the corresponding function of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#getting-values-out-without-copying) - which conversions avoid building a basic_json value
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#getting-values-out-without-copying) - which conversions avoid building a basic_json value
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ still refers to it — including ones taken before the change — reads the new
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](../../features/json_view.md) - guide to documents and views
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md) - guide to documents and views
|
||||
- [`basic_json_document`](../basic_json_document/index.md) - the document that owns the parsed data
|
||||
- [`json_view`](../json_view.md) - and [`json_editable_view`](../json_editable_view.md) - the default specializations
|
||||
- [`materialize`](materialize.md) - build a `basic_json` value from a view
|
||||
|
||||
@@ -54,7 +54,7 @@ A `basic_json_view` is not convertible to `#!cpp bool`: such a conversion would
|
||||
- [`(constructor)`](basic_json_view.md) - the default constructor creates a discarded view
|
||||
- [`basic_json_document::is_discarded`](../basic_json_document/is_discarded.md) - return whether the last parse failed
|
||||
- [`BasicJsonType::is_discarded`](../basic_json/is_discarded.md) - the corresponding function of `basic_json`
|
||||
- [Zero-copy JSON views](../../features/json_view.md#what-is-different) - how views differ from basic_json
|
||||
- [Zero-copy JSON views](../../features/json_view/differences.md) - how views differ from basic_json
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ never caches the result.
|
||||
- [`root`](../basic_json_document/root.md) - the view of a document's root value
|
||||
- [`BasicJsonType::parse`](../basic_json/parse.md) - build a `BasicJsonType` value directly from a JSON text
|
||||
- [`JSON_DIAGNOSTIC_POSITIONS`](../macros/json_diagnostic_positions.md) - source positions on parsed values
|
||||
- [Zero-copy JSON views](../../features/json_view.md#getting-values-out-without-copying) - when to build a basic_json value from a view
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#getting-values-out-without-copying) - when to build a basic_json value from a view
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ source
|
||||
- [`number_token`](number_token.md) - get a single number's token text without dumping the whole value
|
||||
- [`BasicJsonType::error_handler_t`](../basic_json/error_handler_t.md) - the analogous enumeration for
|
||||
`BasicJsonType::dump`'s decoding-error behavior
|
||||
- [Zero-copy JSON views](../../features/json_view.md#writing-a-view-back) - writing numbers as they appeared in the source
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#writing-a-view-back) - writing numbers as they appeared in the source
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ buffer — and is valid exactly as long as that text is, see the [validity rules
|
||||
- [`BasicJsonType::number_integer_t`](../basic_json/number_integer_t.md),
|
||||
[`number_unsigned_t`](../basic_json/number_unsigned_t.md), [`number_float_t`](../basic_json/number_float_t.md) - the
|
||||
number types `#!cpp get<T>()` and `materialize()` convert into
|
||||
- [Zero-copy JSON views](../../features/json_view.md#getting-values-out-without-copying) - reading a number exactly as written
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#getting-values-out-without-copying) - reading a number exactly as written
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ document.
|
||||
[`materialize()`](materialize.md) or iterate the members with [`items()`](items.md) and keep the last match.
|
||||
The key hash index of a larger object (128 members or more) leads to the first member of a key as well.
|
||||
[`begin()`](begin.md)/[`end()`](end.md) and [`items()`](items.md) iterate over *all* members, including
|
||||
duplicates, in document order. See [Duplicate keys](../../features/json_view.md#duplicate-keys) and
|
||||
duplicates, in document order. See [Duplicate keys](../../features/json_view/differences.md#duplicate-keys) and
|
||||
[`size()`](size.md#notes).
|
||||
|
||||
!!! info "JSON pointer resolution"
|
||||
|
||||
@@ -19,7 +19,7 @@ Neither overload builds a `BasicJsonType` value for a view to do the comparison
|
||||
compare by value across their types (`#!cpp 1 == 1.0`), and an object compares by its members, with duplicate keys
|
||||
resolved exactly as `parse()` resolves them — the last value, at the position of the first occurrence of the key.
|
||||
This is not what [`operator[]`](operator[].md) and the other lookups return for a duplicate key: they find the *first*
|
||||
member (see [Duplicate keys](../../features/json_view.md#duplicate-keys)).
|
||||
member (see [Duplicate keys](../../features/json_view/differences.md#duplicate-keys)).
|
||||
|
||||
## Parameters
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ Linear, as [`dump`](dump.md#complexity).
|
||||
- [`dump`](dump.md) - serialize to a JSON-formatted string
|
||||
- [`operator<<(std::ostream&)`](../operator_ltlt.md) - the corresponding operator for `basic_json`
|
||||
- [`JSON_NO_IO`](../macros/json_no_io.md) - switch off functions relying on certain C++ I/O headers
|
||||
- [Zero-copy JSON views](../../features/json_view.md#writing-a-view-back) - writing a view back without building a tree
|
||||
- [Zero-copy JSON views](../../features/json_view/reading.md#writing-a-view-back) - writing a view back without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ string, whose token length is not the same as its decoded [`size()`](size.md).
|
||||
|
||||
- [`source`](../basic_json_document/source.md) - the parsed text
|
||||
- [`is_string`](is_string.md) - return whether the value is a string
|
||||
- [Zero-copy JSON views](../../features/json_view.md#images) - images and the source text
|
||||
- [Zero-copy JSON views](../../features/json_view/images.md) - images and the source text
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ Pointer path of the value within the document, and with
|
||||
|
||||
If the source text repeats a key, this resolves to the *first* member with it, not to the last one that
|
||||
[`materialize()`](materialize.md) and `parse()` keep. See the [Notes on duplicate keys](operator[].md#notes) of
|
||||
`operator[]` and [Duplicate keys](../../features/json_view.md#duplicate-keys) for the reasons and for how to get
|
||||
`operator[]` and [Duplicate keys](../../features/json_view/differences.md#duplicate-keys) for the reasons and for how to get
|
||||
the last value.
|
||||
|
||||
!!! info "Differences to `at` and `operator[]`"
|
||||
|
||||
@@ -49,7 +49,7 @@ view class.
|
||||
- [basic_json_view](basic_json_view/index.md) - a handle to one value of a document
|
||||
- [get](basic_json_view/get.md) - which conversions read the view directly
|
||||
- [view_mode](view_mode.md) - read-only or editable
|
||||
- [Writing generic code](../features/json_view.md#writing-generic-code) - functions and `from_json()` for views
|
||||
- [Writing generic code](../features/json_view/generic_code.md) - functions and `from_json()` for views
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ specialization.
|
||||
|
||||
- [`json_view`](json_view.md) - a view of a value of a `json_document`
|
||||
- [`ordered_json_document`](ordered_json_document.md) - the corresponding document for `ordered_json`
|
||||
- [Zero-copy JSON views](../features/json_view.md) - how to parse, inspect and edit a document without building a tree
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - how to parse, inspect and edit a document without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ This type is an **editable** [`basic_json_document`](basic_json_document/index.m
|
||||
[`json`](json.md) specialization: in addition to everything [`json_document`](json_document.md) offers,
|
||||
[`set`](basic_json_document/set.md) and [`push_back`](basic_json_document/push_back.md) change values after
|
||||
parsing, without ever rewriting the source text — see [Edits](basic_json_document/index.md#edits) and
|
||||
[Editing a document](../features/json_view.md#editing-a-document).
|
||||
[Editing a document](../features/json_view/editing.md).
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ still referring to it seeing the change, see [Edits](basic_json_document/index.m
|
||||
- [`json_view`](json_view.md) - the corresponding read-only view
|
||||
- [`ordered_json_editable_view`](ordered_json_editable_view.md) - the corresponding view for
|
||||
`ordered_json_editable_document`
|
||||
- [Zero-copy JSON views](../features/json_view.md#editing-a-document) - editing a document in place and writing it back
|
||||
- [Zero-copy JSON views](../features/json_view/editing.md) - editing a document in place and writing it back
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of a [`j
|
||||
|
||||
- [`json_document`](json_document.md) - the document type this view refers into
|
||||
- [`ordered_json_view`](ordered_json_view.md) - the corresponding view for `ordered_json_document`
|
||||
- [Zero-copy JSON views](../features/json_view.md) - how to parse, inspect and edit a document without building a tree
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - how to parse, inspect and edit a document without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ By default, `#!cpp JSON_NO_SIMD` is not defined, and vector instructions are use
|
||||
- [Parsing: input sources and performance](../../features/parsing/index.md#input-sources-and-performance) - how input
|
||||
sources affect parsing performance
|
||||
- [Serialization](../../features/serialization.md) - pretty-printing, UTF-8 handling, and number output
|
||||
- [Zero-copy JSON views](../../features/json_view.md) - the zero-copy view, whose parser the macro also affects
|
||||
- [Zero-copy JSON views](../../features/json_view/index.md) - the zero-copy view, whose parser the macro also affects
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ of object keys, instead of sorting them like [`json_document`](json_document.md)
|
||||
- [`ordered_json_view`](ordered_json_view.md) - a view of a value of an `ordered_json_document`
|
||||
- [`json_document`](json_document.md) - the corresponding document for the default `json` specialization
|
||||
- [Object Order](../features/object_order.md) - preserving the insertion order of object keys
|
||||
- [Zero-copy JSON views](../features/json_view.md) - how to parse, inspect and edit a document without building a tree
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - how to parse, inspect and edit a document without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ members [`set`](basic_json_document/set.md) added — instead of sorting them li
|
||||
specialization
|
||||
- [Object Order](../features/object_order.md) - preserving the insertion order of object keys
|
||||
- [Edits](basic_json_document/index.md#edits) - what an edit guarantees
|
||||
- [Zero-copy JSON views](../features/json_view.md#editing-a-document) - editing a document in place and writing it back
|
||||
- [Zero-copy JSON views](../features/json_view/editing.md) - editing a document in place and writing it back
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of an
|
||||
- [`ordered_json_editable_document`](ordered_json_editable_document.md) - the document type this view refers into
|
||||
- [`ordered_json_view`](ordered_json_view.md) - the corresponding read-only view
|
||||
- [`json_editable_view`](json_editable_view.md) - the corresponding view for `json_editable_document`
|
||||
- [Zero-copy JSON views](../features/json_view.md#editing-a-document) - editing a document in place and writing it back
|
||||
- [Zero-copy JSON views](../features/json_view/editing.md) - editing a document in place and writing it back
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ This type is a [`basic_json_view`](basic_json_view/index.md) of a value of an
|
||||
|
||||
- [`ordered_json_document`](ordered_json_document.md) - the document type this view refers into
|
||||
- [`json_view`](json_view.md) - the corresponding view for `json_document`
|
||||
- [Zero-copy JSON views](../features/json_view.md) - how to parse, inspect and edit a document without building a tree
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - how to parse, inspect and edit a document without building a tree
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ nor a [`json_editable_view`](json_editable_view.md). Views of the two modes comp
|
||||
- [basic_json_view](basic_json_view/index.md) - a handle to one value of a document
|
||||
- [json_editable_document](json_editable_document.md) - an editable document of `json`
|
||||
- [(constructor)](basic_json_view/basic_json_view.md) - the conversion from a read-only to an editable view
|
||||
- [Writing generic code](../features/json_view.md#writing-generic-code) - functions that accept views
|
||||
- [Writing generic code](../features/json_view/generic_code.md) - functions that accept views
|
||||
|
||||
## Version history
|
||||
|
||||
|
||||
@@ -759,9 +759,14 @@ body:has(.nj-hero) .md-content {
|
||||
}
|
||||
}
|
||||
|
||||
/* blog posts: author and date right below the title */
|
||||
.md-typeset .nj-byline { margin: -.8rem 0 1.6rem; font-size: .75rem; color: var(--md-default-fg-color--light); }
|
||||
.md-typeset .nj-byline a { color: inherit; }
|
||||
.md-typeset .nj-byline a:hover { color: var(--md-accent-fg-color); }
|
||||
|
||||
/* figure captions: "Figure N." in bold, close to the figure, set in from the text column; figures and tables are
|
||||
numbered per page, each with its own counter */
|
||||
.md-content__inner { counter-reset: nj-figure nj-table; }
|
||||
.md-content__inner { counter-reset: nj-figure nj-table nj-listing; }
|
||||
.md-typeset :is(.nj-caption, .nj-charts-caption) {
|
||||
max-width: none;
|
||||
margin: .3rem 2rem 1.5rem;
|
||||
@@ -782,6 +787,25 @@ body:has(.nj-hero) .md-content {
|
||||
.md-typeset :is(.nj-caption, .nj-charts-caption) { margin-inline: 1rem; }
|
||||
}
|
||||
|
||||
/* code captions: "Listing N." in bold, directly below the code block, in the figure caption style */
|
||||
.md-typeset .nj-code-caption {
|
||||
max-width: none;
|
||||
margin: -.4rem 2rem 1.5rem;
|
||||
font-size: .75rem;
|
||||
line-height: 1.5;
|
||||
text-align: left;
|
||||
color: var(--md-default-fg-color--light);
|
||||
}
|
||||
.md-typeset .nj-code-caption::before {
|
||||
counter-increment: nj-listing;
|
||||
content: "Listing " counter(nj-listing) ". ";
|
||||
font-weight: 700;
|
||||
color: var(--md-default-fg-color);
|
||||
}
|
||||
@media screen and (max-width: 44.9375em) {
|
||||
.md-typeset .nj-code-caption { margin-inline: 1rem; }
|
||||
}
|
||||
|
||||
/* table captions: "Table N." in bold, directly below the table, in the figure caption style */
|
||||
.md-typeset .nj-table-caption {
|
||||
max-width: none;
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
|
||||
.md-typeset svg.nj-charts--compile, .md-typeset svg.nj-charts--scaling { max-width: 26rem; }
|
||||
.md-typeset svg.nj-charts--sizes { max-width: 26rem; }
|
||||
/* home/blog/how_3_13_0_got_faster.md (scripts/figures/perf_blog.py) */
|
||||
.md-typeset svg.nj-charts--blog { max-width: 34rem; }
|
||||
.md-typeset svg.nj-charts--swar { max-width: 34rem; }
|
||||
.md-typeset svg.nj-charts--timeline { max-width: 22rem; }
|
||||
|
||||
.nj-charts text { fill: currentColor; font-size: 13px; }
|
||||
.nj-charts .nj-charts-leg { font-size: 13.5px; }
|
||||
@@ -43,10 +47,34 @@
|
||||
paint-order: stroke; stroke: var(--md-default-bg-color); stroke-width: 4px; stroke-linejoin: round; }
|
||||
.nj-charts .nj-charts-factor { fill: var(--nj-charts-ink2); font-size: 12px; font-weight: 600; text-anchor: middle; }
|
||||
.nj-charts .nj-charts-note { fill: var(--nj-charts-ink2); font-size: 12px; }
|
||||
/* heatmap cells (perf_blog_usecases_*.svg): green for the fastest, gray around twice the time, red for the slowest;
|
||||
adjacent steps checked for CVD separation on the light and the slate surface; the numbers are in every cell */
|
||||
.md-typeset svg.nj-charts--heat { max-width: 49rem; }
|
||||
.nj-charts--heat { --nj-heat-0: #3fa557; --nj-heat-1: #8bcc95; --nj-heat-2: #ebeae6; --nj-heat-3: #f2ae9b;
|
||||
--nj-heat-4: #dc5a43; --nj-heat-ink: #1b1b1b; --nj-heat-ink-strong: #1b1b1b; }
|
||||
[data-md-color-scheme="slate"] .nj-charts--heat { --nj-heat-0: #3a9d50; --nj-heat-1: #2c6b3a; --nj-heat-2: #33353a;
|
||||
--nj-heat-3: #8a3f2e; --nj-heat-4: #d95b3a; --nj-heat-ink: #e8e8e6; --nj-heat-ink-strong: #141414; }
|
||||
.nj-charts .nj-heat-0 { fill: var(--nj-heat-0); }
|
||||
.nj-charts .nj-heat-1 { fill: var(--nj-heat-1); }
|
||||
.nj-charts .nj-heat-2 { fill: var(--nj-heat-2); }
|
||||
.nj-charts .nj-heat-3 { fill: var(--nj-heat-3); }
|
||||
.nj-charts .nj-heat-4 { fill: var(--nj-heat-4); }
|
||||
.nj-charts .nj-heat-na { fill: none; stroke: var(--nj-charts-grid); stroke-width: 1; }
|
||||
.nj-charts .nj-charts-cell { fill: var(--nj-heat-ink); font-size: 12px; font-variant-numeric: tabular-nums; }
|
||||
.nj-charts :is(.nj-heat-0, .nj-heat-4) ~ .nj-charts-cell { fill: var(--nj-heat-ink-strong); }
|
||||
.nj-charts .nj-charts-cell--small { font-size: 10.5px; }
|
||||
.nj-charts .nj-heat-cell { cursor: default; outline: none; }
|
||||
.nj-charts .nj-heat-cell:is(:hover, :focus-visible, .nj-heat-on) rect { stroke: var(--md-default-fg-color); stroke-width: 1.5; }
|
||||
.nj-heat-tip { position: absolute; z-index: 5; max-width: 24rem; padding: .5rem .7rem; border-radius: 6px;
|
||||
background: var(--md-default-bg-color); color: var(--md-default-fg-color);
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, .25); font-size: .68rem; line-height: 1.45; pointer-events: none; }
|
||||
.nj-heat-tip strong { display: block; margin-bottom: .2rem; }
|
||||
.nj-heat-tip[hidden] { display: none; }
|
||||
|
||||
.nj-charts .nj-charts-grid { stroke: var(--nj-charts-grid); stroke-width: 1; }
|
||||
.nj-charts .nj-charts-zero, .nj-charts .nj-charts-axis { stroke: var(--nj-charts-base); stroke-width: 1.5; }
|
||||
.nj-charts .nj-charts-ref { stroke: currentColor; stroke-width: 1.5; }
|
||||
.nj-charts .nj-charts-head { fill: var(--nj-charts-base); }
|
||||
|
||||
.nj-charts .nj-charts-c1 { fill: var(--nj-charts-c1); }
|
||||
.nj-charts .nj-charts-c2 { fill: var(--nj-charts-c2); }
|
||||
@@ -140,3 +168,19 @@
|
||||
/* direct line labels replace the legend */
|
||||
.nj-charts .nj-charts-name-json { fill: var(--nj-charts-json-c); font-weight: 600; }
|
||||
.nj-charts .nj-charts-name-ojson { fill: var(--nj-charts-ojson-c); font-weight: 600; }
|
||||
|
||||
/* theme badges of home/blog/how_3_13_0_got_faster.md: the number of one of the eight themes, as a digit in a blue
|
||||
circle, in headings, text, tables and the timeline figures (nj-theme-dot); "U" and other marks are gray */
|
||||
.md-typeset .nj-theme { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box;
|
||||
min-width: 1.45em; height: 1.45em; padding: 0 .3em; border-radius: .725em; vertical-align: .08em;
|
||||
background: var(--nj-blue); color: var(--md-default-bg-color); font-size: .78em; font-weight: 700; line-height: 1;
|
||||
font-variant-numeric: tabular-nums; text-decoration: none; }
|
||||
.md-typeset a.nj-theme:is(:hover, :focus-visible) { background: var(--nj-blue-deep); color: var(--md-default-bg-color); }
|
||||
.md-typeset .nj-theme--other { background: var(--md-default-fg-color--light); }
|
||||
.md-typeset h2 .nj-theme { margin-right: .35em; vertical-align: .12em; }
|
||||
.md-typeset .nj-theme-list > ul { list-style: none; margin-left: 0; }
|
||||
.md-typeset .nj-theme-list > ul > li { margin-left: 0; padding-left: 2em; text-indent: -2em; }
|
||||
.md-typeset .nj-theme-list > ul > li > .nj-theme { margin-right: .55em; text-indent: 0; }
|
||||
.nj-charts .nj-theme-dot { fill: var(--nj-blue); }
|
||||
.nj-charts .nj-theme-dot--other { fill: var(--nj-charts-ink2); }
|
||||
.nj-charts .nj-theme-num { fill: var(--md-default-bg-color); font-size: 11px; font-weight: 700; }
|
||||
@@ -1,4 +1,4 @@
|
||||
/* figures: jsonview (features/json_view.md; SVGs from scripts/figures/json_view_layout.py, stepper in js/fig-jsonview.js) */
|
||||
/* figures: jsonview (features/json_view/*.md; SVGs from scripts/figures/json_view_layout.py, stepper in js/fig-jsonview.js) */
|
||||
|
||||
/* one colour per concept, the same in every figure: structure (object/array, views) blue, keys navy, strings green,
|
||||
numbers orange, decoded strings purple, owned edit storage teal, dangling/invalid red */
|
||||
|
||||
@@ -48,7 +48,7 @@ which avoids repeating it:
|
||||
[`number_token()`](../api/basic_json_view/number_token.md) returns a number exactly as it was written. Every other
|
||||
type is obtained from a subtree that is built on demand with
|
||||
[`materialize()`](../api/basic_json_view/materialize.md). See
|
||||
[Zero-copy JSON views](json_view.md#getting-values-out-without-copying).
|
||||
[Zero-copy JSON views](json_view/reading.md#getting-values-out-without-copying).
|
||||
|
||||
The library already knows how to convert to and from the scalar types and the STL containers (such as
|
||||
`#!cpp std::vector`, `#!cpp std::map`, `#!cpp std::array`, `#!cpp std::optional`, and many more). Converting a JSON
|
||||
@@ -269,7 +269,7 @@ The conversions above are built in for standard types. To make the same syntax w
|
||||
- [`get_ref`](../api/basic_json/get_ref.md) - / [`get_ptr`](../api/basic_json/get_ptr.md) - access the stored value without copying
|
||||
- [Arbitrary types conversions](arbitrary_types.md) - support your own types
|
||||
- [`JSON_USE_IMPLICIT_CONVERSIONS`](../api/macros/json_use_implicit_conversions.md) - toggle implicit conversions
|
||||
- [Zero-copy JSON views](json_view.md) - get values out of a document or a view
|
||||
- [Zero-copy JSON views](json_view/index.md) - get values out of a document or a view
|
||||
- [`adl_serializer`](../api/adl_serializer/index.md) - the default serializer behind the conversions
|
||||
- [`type`](../api/basic_json/type.md) - query the type of a value
|
||||
- [`JSON_DISABLE_TUPLE_REFERENCE_CONVERSION`](../api/macros/json_disable_tuple_reference_conversion.md) - toggle conversion to tuples of references
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
There are several ways to create a JSON value in memory. This page gives an overview; to read a value from JSON text
|
||||
instead, see [parsing](parsing/index.md). A JSON text can also be parsed into a
|
||||
[document](../api/basic_json_document/index.md) and read through a [view](../api/basic_json_view/index.md) instead of
|
||||
into a value; see [Zero-copy JSON views](json_view.md).
|
||||
into a value; see [Zero-copy JSON views](json_view/index.md).
|
||||
|
||||
## From C++ values
|
||||
|
||||
@@ -122,7 +122,7 @@ string `#!json "42"`.
|
||||
- [`operator""_json`](../api/operator_literal_json.md) - the `_json` literal
|
||||
- [Converting values](conversions.md) - which C++ types can be used
|
||||
- [Parsing](parsing/index.md) - create a value from JSON text
|
||||
- [Zero-copy JSON views](json_view.md) - create a document and a view from JSON text instead of a value
|
||||
- [Zero-copy JSON views](json_view/index.md) - create a document and a view from JSON text instead of a value
|
||||
- [`basic_json`](../api/basic_json/index.md) - the class template and its member functions
|
||||
- [Types](types/index.md) - the JSON value types
|
||||
- [`JSON_BRACE_INIT_COPY_SEMANTICS`](../api/macros/json_brace_init_copy_semantics.md) - change how a single braced value is interpreted
|
||||
|
||||
@@ -37,7 +37,7 @@ json read_json_file(const std::string& path)
|
||||
memory for the copy (see [input sources and performance](parsing/index.md#input-sources-and-performance)). The common
|
||||
way to read a file with `#!cpp std::istreambuf_iterator<char>` is so slow that it takes about twice as long as parsing
|
||||
from the stream. This advice is for
|
||||
`#!cpp json::parse`. [`json_document`](json_view.md) reads a stream into a buffer that it owns anyway, so there is no
|
||||
`#!cpp json::parse`. [`json_document`](json_view/index.md) reads a stream into a buffer that it owns anyway, so there is no
|
||||
copy to save: reading the file into a `#!cpp std::string` yourself and passing that as an lvalue, which the document
|
||||
borrows, was about 6 to 12 % faster than parsing from the stream, with the same single buffer.
|
||||
- `parse` requires the file to hold exactly one JSON value. Files with one value per line are read with
|
||||
|
||||
@@ -13,10 +13,10 @@ C++ types, and finally serialize it again.
|
||||
[SAX interface](parsing/sax_interface.md), [error handling](parsing/parse_exceptions.md),
|
||||
[large and partial input](parsing/large_and_partial_input.md), and
|
||||
[parsing untrusted input](parsing/untrusted_input.md).
|
||||
- [Zero-copy JSON views](json_view.md) — read a JSON text through a flat index instead of building a `json` tree;
|
||||
- [Zero-copy JSON views](json_view/index.md) — read a JSON text through a flat index instead of building a `json` tree;
|
||||
strings and numbers stay in the input and are only decoded when needed.
|
||||
- [Editable documents](json_view.md#editing-a-document) — modify a parsed document without building a `json` tree.
|
||||
- [Images](json_view.md#images) — save a parsed document and load it again without parsing it.
|
||||
- [Editable documents](json_view/editing.md) — modify a parsed document without building a `json` tree.
|
||||
- [Images](json_view/images.md) — save a parsed document and load it again without parsing it.
|
||||
- [Comments](comments.md) and [trailing commas](trailing_commas.md) — opt-in relaxations of the JSON grammar.
|
||||
|
||||
## Accessing and modifying values
|
||||
|
||||
@@ -1,591 +0,0 @@
|
||||
# Zero-copy JSON views
|
||||
|
||||
`#!cpp <nlohmann/json_view.hpp>` adds a read-only, non-owning way to look at a parsed JSON text, as an alternative to
|
||||
building a [`basic_json`](../api/basic_json/index.md) tree with [`parse()`](../api/basic_json/parse.md).
|
||||
|
||||
## The problem
|
||||
|
||||
[`basic_json::parse()`](../api/basic_json/parse.md) builds a tree of `basic_json` values: one allocation for every
|
||||
array and object, and every string copied into its own `std::string`. That is the right trade-off when the program
|
||||
goes on to read and write the value freely, but it does more work than necessary when only a small part of a large
|
||||
JSON text is actually needed, or when the same text is parsed over and over (many small messages, for instance) and
|
||||
most of the resulting tree is thrown away almost immediately.
|
||||
|
||||
## The idea
|
||||
|
||||
[`basic_json_document::parse()`](../api/basic_json_document/parse.md) parses the same JSON grammar, with the same
|
||||
options, but instead of a tree it builds a flat index of the values it found: one
|
||||
[16-byte entry](../home/architecture.md#node-index-of-json-views) per value (and one per object key), in document
|
||||
order. Integers are converted while parsing and stored in their entry. Floating-point numbers and strings are
|
||||
referenced in place in the source text: a float is converted when it is read, and only strings that contain escape
|
||||
sequences are decoded, into one shared buffer owned by the document.
|
||||
|
||||
[`basic_json_view`](../api/basic_json_view/index.md) is a small, trivially copyable handle (two pointers) into that
|
||||
index. It gives you the read-only, type-inspection part of the `basic_json` interface —
|
||||
[`type()`](../api/basic_json_view/type.md) and the `is_*()` predicates,
|
||||
[`size()`](../api/basic_json_view/size.md)/[`empty()`](../api/basic_json_view/empty.md) — as well as element access
|
||||
([`operator[]`](../api/basic_json_view/operator%5B%5D.md), [`at`](../api/basic_json_view/at.md),
|
||||
[`front`](../api/basic_json_view/front.md)/[`back`](../api/basic_json_view/back.md)), lookup
|
||||
([`find`](../api/basic_json_view/find.md), [`contains`](../api/basic_json_view/contains.md),
|
||||
[`count`](../api/basic_json_view/count.md)), and iteration
|
||||
([`begin`](../api/basic_json_view/begin.md)/[`end`](../api/basic_json_view/end.md),
|
||||
[`items`](../api/basic_json_view/items.md)) — without ever allocating a `basic_json` value. When you do need an
|
||||
actual `basic_json` value for a subtree, [`materialize()`](../api/basic_json_view/materialize.md) builds exactly the
|
||||
one [`parse()`](../api/basic_json/parse.md) would have produced for it.
|
||||
|
||||
The same small text, parsed both ways:
|
||||
|
||||
<div class="nj-fig-wrap" markdown>
|
||||
--8<-- "images/json_view_layout.svg"
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>Top: the tree of separate heap allocations that `basic_json::parse()` builds. Bottom: `json_document::parse()` keeps the source text and builds one flat index of 16-byte nodes that point back into it, plus a buffer of decoded strings.</p>
|
||||
|
||||
## How to use it
|
||||
|
||||
Include `<nlohmann/json_view.hpp>` in addition to (or instead of) `<nlohmann/json.hpp>`. Parse into a
|
||||
[`json_document`](../api/json_document.md), inspect its [`root()`](../api/basic_json_document/root.md), and
|
||||
`materialize()` when you need a real value. `materialize()` works on any view, not just the root, so you can turn just
|
||||
the subtree you need into a value:
|
||||
|
||||
??? example "Example: parse a document, inspect its root, and materialize it"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_document.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_document.output"
|
||||
```
|
||||
|
||||
[`ordered_json_document`](../api/ordered_json_document.md) is the equivalent for
|
||||
[`ordered_json`](../api/ordered_json.md), just as [`ordered_json`](../api/ordered_json.md) is to
|
||||
[`json`](../api/json.md).
|
||||
|
||||
## Ownership and lifetime
|
||||
|
||||
A document either **borrows** the text it was parsed from, or **owns** its own copy of it; call
|
||||
[`owns_source()`](../api/basic_json_document/owns_source.md) to find out which happened.
|
||||
[`parse()`](../api/basic_json_document/parse.md) decides this from the value category and type of its argument (an
|
||||
lvalue `#!cpp std::string` is borrowed; an rvalue `#!cpp std::string` is moved in, owned without a copy; a stream is
|
||||
read into an owned buffer; and so on — see [`parse`'s Notes](../api/basic_json_document/parse.md#notes) for the full
|
||||
table). [`parse_copy()`](../api/basic_json_document/parse_copy.md) always owns a copy, regardless of the input.
|
||||
|
||||
!!! warning "A borrowed document depends on your buffer"
|
||||
|
||||
If a document borrows its text, that text **must outlive the document** (and every view taken from it) and must
|
||||
stay **unmodified** for as long as the document exists, since floating-point values and unescaped strings are
|
||||
read from it lazily. Reading or writing through a view after the underlying buffer is gone is undefined behavior,
|
||||
exactly as it would be for a dangling `#!cpp std::string_view`.
|
||||
|
||||
A view is valid only while all of the following hold:
|
||||
|
||||
- the document is alive,
|
||||
- the document has not been re-parsed since the view was taken (with [`read()`](../api/basic_json_document/read.md)
|
||||
or [`parse()`](../api/basic_json_document/parse.md) into it),
|
||||
- the document has not had [`shrink_to_fit()`](../api/basic_json_document/shrink_to_fit.md) called on it since, and
|
||||
- if the document borrows its source text, that text is still alive and unmodified.
|
||||
|
||||
Moving the `basic_json_document<>` itself is fine and does **not** invalidate its views: the index is a separate heap
|
||||
allocation that keeps its address across the move. Take a fresh view from [`root()`](../api/basic_json_document/root.md)
|
||||
whenever any of the other conditions above was not met.
|
||||
|
||||
<div class="nj-fig-wrap" markdown>
|
||||
--8<-- "images/json_view_lifetime.svg"
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>Four timelines of a document and its views, each bar showing when an object is alive or valid and when it dangles. Destroying the borrowed text, re-parsing, or shrinking the document invalidates the views taken before; moving the document does not.</p>
|
||||
|
||||
A view can dangle, exactly like a `#!cpp std::string_view`: nothing stops you from using it after its document is
|
||||
gone. This is deliberate. A view is two pointers and trivially copyable; making it safe (a `#!cpp std::shared_ptr` in
|
||||
the document and a `#!cpp std::weak_ptr` in each view) would make it larger, add reference counting to every copy,
|
||||
and a `lock()` to every access — exactly the costs the view exists to avoid. What is caught is the obvious case:
|
||||
because a view dies with its document, [`root()`](../api/basic_json_document/root.md) is not callable on a temporary
|
||||
document: `#!cpp auto v = json_document::parse(text).root();` does not compile. Give the document a name first.
|
||||
|
||||
??? example "Example: borrowed and owned documents, and when views become invalid"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_view_ownership.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_view_ownership.output"
|
||||
```
|
||||
|
||||
## What is the same as `parse()`
|
||||
|
||||
- **Accept/reject.** [`accept()`](../api/basic_json_document/accept.md) and
|
||||
[`parse()`](../api/basic_json_document/parse.md) accept and reject exactly the same inputs as
|
||||
[`basic_json::accept()`](../api/basic_json/accept.md)/[`basic_json::parse()`](../api/basic_json/parse.md), with the
|
||||
same `ignore_comments` and `ignore_trailing_commas` options.
|
||||
- **Errors.** A failing parse throws the same exception — the same id, message, and position — because on failure
|
||||
the library's own parser is run on the same bytes to produce the diagnostic. Valid input never pays for this, and
|
||||
the replay builds no values: it costs about a lexing pass up to the error.
|
||||
`#!cpp allow_exceptions == false` skips the replay and gives a
|
||||
[discarded](../api/basic_json_document/is_discarded.md) document instead of throwing, just as it gives a discarded
|
||||
value for `#!cpp basic_json::parse()`.
|
||||
- **Number classification.** An integer literal that does not fit into the 64-bit integer type becomes a
|
||||
floating-point value, exactly as it does for `#!cpp basic_json::parse()`.
|
||||
- **Macros.** [`JSON_STRICT_NUL_HANDLING`](../api/macros/json_strict_nul_handling.md) and
|
||||
[`JSON_NOEXCEPTION`](../api/macros/json_noexception.md)/[`JSON_THROW_USER`](../api/macros/json_throw_user.md)
|
||||
behave the same way they do for `<nlohmann/json.hpp>`. These are the macros that change what the parser accepts or
|
||||
how it reports errors. Two more macros add context to the exceptions of views, as they do for those of
|
||||
`#!cpp basic_json`:
|
||||
|
||||
- With [`JSON_DIAGNOSTICS`](../api/macros/json_diagnostics.md), an exception names the JSON Pointer path of the
|
||||
value within the document.
|
||||
- With [`JSON_DIAGNOSTIC_POSITIONS`](../api/macros/json_diagnostic_positions.md), an exception names the bytes of
|
||||
the value in the source text.
|
||||
|
||||
A view has neither parent pointers nor stored positions, so both are found from the document's index when the
|
||||
exception is thrown. This takes time linear in the size of the document. One exception has neither:
|
||||
`key()` of an iterator over an array or a primitive value
|
||||
([`invalid_iterator.207`](../home/exceptions.md#jsonexceptioninvalid_iterator207)), because a view's iterator does
|
||||
not know the value it iterates over.
|
||||
|
||||
The other macros only affect the values `materialize()` produces, through `BasicJsonType`.
|
||||
|
||||
## What is different
|
||||
|
||||
- **Only 64-bit integers.** `basic_json_document<BasicJsonType>` requires `BasicJsonType::number_integer_t` and
|
||||
`number_unsigned_t` to both be 64 bits wide; this is a compile-time `#!cpp static_assert`.
|
||||
- **A 4 GiB input limit.** An input of 4294967280 bytes (4 GiB minus 16 bytes) or more throws
|
||||
[`out_of_range.416`](../home/exceptions.md#jsonexceptionout_of_range416), a limit
|
||||
`#!cpp basic_json::parse()` does not have. It keeps an index entry at 16 bytes: offsets and counts are 32 bits
|
||||
wide. The limit is 16 bytes below 2^32, because the parser reads in 16-byte steps, and a position one step past the
|
||||
end must still fit.
|
||||
- **A stream is always read to its end.** There is no partial/streaming read of an `#!cpp std::istream`: the stream
|
||||
is read to its end into a buffer the document owns, and parsing starts after that. For a file, reading it into a
|
||||
`#!cpp std::string` yourself and parsing that (an lvalue is borrowed) is therefore not more expensive in memory, and
|
||||
was about 6 to 12 % faster than parsing from an `#!cpp std::ifstream`.
|
||||
- **Fewer source positions after edits.** With
|
||||
[`JSON_DIAGNOSTIC_POSITIONS`](../api/macros/json_diagnostic_positions.md) enabled,
|
||||
[`materialize()`](../api/basic_json_view/materialize.md) sets the same positions as `#!cpp basic_json::parse()`.
|
||||
In an [editable document](../api/json_editable_document.md), a value written by an edit has none, and neither has
|
||||
an array or object whose elements changed or whose last element has none; a `basic_json` value keeps its positions
|
||||
when it is changed. See [`materialize()`](../api/basic_json_view/materialize.md#notes).
|
||||
- **Objects iterate in document order.** [`begin()`](../api/basic_json_view/begin.md)/
|
||||
[`end()`](../api/basic_json_view/end.md) and [`items()`](../api/basic_json_view/items.md) visit an object's
|
||||
members in the order they appear in the source text. `basic_json`'s default `object_t` is a `std::map`, which
|
||||
sorts by key, so iterating a [`materialize()`](../api/basic_json_view/materialize.md)d value can print members in
|
||||
a different order than iterating the view they came from.
|
||||
- **Chained access is safe.** [`operator[]`](../api/basic_json_view/operator%5B%5D.md) with a missing key, an index
|
||||
out of range, or an unresolvable JSON pointer returns a [discarded](../api/basic_json_view/is_discarded.md) view, and
|
||||
`operator[]` on a discarded view returns a discarded view without throwing: `#!cpp v["a"]["b"][0]` can be tested
|
||||
once at the end. Type errors on values that exist (a key on an array, an index on an object) still throw, and
|
||||
[`at`](../api/basic_json_view/at.md) throws for every missing value.
|
||||
- **Duplicate keys: lookups find the first member, `parse()` keeps the last.** See [Duplicate keys](#duplicate-keys)
|
||||
below.
|
||||
- **Ordering comparisons are not provided** by `basic_json_view` — there is no `#!cpp operator<`.
|
||||
[`operator==`](../api/basic_json_view/operator_eq.md) and [`operator!=`](../api/basic_json_view/operator_ne.md) are
|
||||
provided, though: two views, or a view and a `BasicJsonType` value, compare equal exactly when
|
||||
[`materialize()`](../api/basic_json_view/materialize.md) or [`parse()`](../api/basic_json/parse.md) would produce
|
||||
equal values for them, without ever building a tree to do it. For ordering, too,
|
||||
[`materialize()`](../api/basic_json_view/materialize.md) is the way to get a value you can compare.
|
||||
|
||||
## Duplicate keys
|
||||
|
||||
!!! warning "A lookup in a view and in the parsed value can give different answers"
|
||||
|
||||
If an object in the source text repeats a key, [`operator[]`](../api/basic_json_view/operator%5B%5D.md),
|
||||
[`at`](../api/basic_json_view/at.md), [`find`](../api/basic_json_view/find.md),
|
||||
[`value`](../api/basic_json_view/value.md), [`contains`](../api/basic_json_view/contains.md), and JSON pointer
|
||||
resolution all return the **first** member with that key. `basic_json::parse()` instead keeps the **last** value
|
||||
of a repeated key, so for `#!cpp {"a":1,"a":2}`, `#!cpp view["a"]` is `#!cpp 1` while `#!cpp parse(text)["a"]` is
|
||||
`#!cpp 2`. [`count`](../api/basic_json_view/count.md) counts every member with the key, so it is `#!cpp 2` here.
|
||||
|
||||
[`begin()`](../api/basic_json_view/begin.md)/[`end()`](../api/basic_json_view/end.md) and
|
||||
[`items()`](../api/basic_json_view/items.md) visit *every* occurrence, in document order, and
|
||||
[`size()`](../api/basic_json_view/size.md) counts all of them, so `#!cpp view.size()` can be larger than
|
||||
`#!cpp view.materialize().size()`.
|
||||
|
||||
**Why the first?** A lookup can stop as soon as it finds a match. Returning the last member would force every lookup
|
||||
to scan all members of the object, even when the key is found at the very first one: this made lookups in small
|
||||
objects 1.6 to 3.4 times slower. The hash index of the keys of objects with 128 members or more leads to the first member of a
|
||||
key as well. Other zero-copy parsers that index the source text, such as yyjson and simdjson, also return the first
|
||||
member. RFC 8259 only says that names within an object SHOULD be unique and that the behavior of a receiver that sees
|
||||
duplicates is unpredictable, so neither choice is wrong.
|
||||
|
||||
The same holds for [`get<T>()`](../api/basic_json_view/get.md) of a type whose `from_json()` reads the view, such as
|
||||
the types of the `NLOHMANN_DEFINE_TYPE_*` macros: their members are looked up, so `#!cpp get<point>()` of
|
||||
`#!cpp {"x":1,"x":2}` reads `#!cpp x == 1`, while `#!cpp materialize().get<point>()` reads `#!cpp 2`.
|
||||
|
||||
**What stays the same as `parse()`?** [`materialize()`](../api/basic_json_view/materialize.md) and
|
||||
[`get<std::map<...>>()`](../api/basic_json_view/get.md) replay every member in order, so they keep the *last* value
|
||||
exactly like `#!cpp basic_json::parse()` (at the position of the first occurrence of the key, for an
|
||||
[`ordered_json`](../api/ordered_json.md)).
|
||||
|
||||
**How do I get the value `parse()` would give?** Either call `#!cpp view.materialize()` and look the key up in the
|
||||
result, or iterate the members and keep the last match:
|
||||
|
||||
```cpp
|
||||
// the last member with the key "a", as parse() would keep it
|
||||
json_view last;
|
||||
for (const auto item : view.items())
|
||||
{
|
||||
if (item.key() == "a")
|
||||
{
|
||||
last = item.value();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you cannot trust the source text to have unique keys, check [`size()`](../api/basic_json_view/size.md) against the
|
||||
number of distinct keys, or reject duplicates when iterating.
|
||||
|
||||
## Getting values out without copying
|
||||
|
||||
[`get<T>()`](../api/basic_json_view/get.md) converts most `T` directly from the flat index, without ever building a
|
||||
`basic_json` value for the conversion: `#!cpp bool`, arithmetic types, `#!cpp std::nullptr_t`,
|
||||
`#!cpp std::string`/other `#!cpp std::basic_string`s (copied once), `basic_json_view` itself, the standard containers
|
||||
and other types the library converts (`#!cpp std::vector`, `#!cpp std::map`, `#!cpp std::list`, `#!cpp std::array`,
|
||||
`#!cpp std::pair`, `#!cpp std::tuple`, `#!cpp std::optional`, ...), and the types of the `NLOHMANN_DEFINE_TYPE_*` and
|
||||
`NLOHMANN_JSON_SERIALIZE_ENUM` macros. Types whose `from_json()` is written for `basic_json` only go through
|
||||
[`materialize()`](../api/basic_json_view/materialize.md)`.get<T>()` instead: the subtree is built into a real
|
||||
`basic_json` value first, exactly as [`parse()`](../api/basic_json/parse.md) would, and converted from there. See
|
||||
[Writing generic code](#writing-generic-code) for how to write a `from_json()` that reads views.
|
||||
|
||||
Two conversions never copy at all:
|
||||
|
||||
- [`get_string()`](../api/basic_json_view/get_string.md) (equivalently, `#!cpp get<string_view_t>()`) returns a
|
||||
string as a `string_view_t` pointing into the document's [`source()`](../api/basic_json_document/source.md) text —
|
||||
or, for a string that contains escape sequences, into the document's own buffer of decoded strings — instead of
|
||||
allocating a new `#!cpp std::string`.
|
||||
- [`number_token()`](../api/basic_json_view/number_token.md) returns a number exactly as it was written in the
|
||||
source, e.g. `#!cpp "1.50"`, `#!cpp "1E2"`, or an integer with more digits than any number type holds, instead of
|
||||
rounding it into a `#!cpp double`/`#!cpp int64_t` the way `#!cpp get<T>()` (and
|
||||
[`basic_json::parse()`](../api/basic_json/parse.md)) would.
|
||||
|
||||
Both results are only valid as long as the view — and, for a string with no escapes, the borrowed source text — is.
|
||||
|
||||
### `string_view` members
|
||||
|
||||
A struct whose member is a `#!cpp std::string_view` (C++17) can be decoded from a view with the
|
||||
`NLOHMANN_DEFINE_TYPE_*` macros, and the member is not copied either: for a string without escape sequences it points
|
||||
into the document's source text, and for a string with escape sequences into the document's buffer of decoded strings.
|
||||
The member is valid as long as the document is alive and, for a document that
|
||||
[borrows its source text](#ownership-and-lifetime) (as [`parse()`](../api/basic_json_document/parse.md) does for
|
||||
an lvalue `#!cpp std::string`, a `#!cpp std::string_view`, or a C string), as long as that text is.
|
||||
|
||||
```cpp
|
||||
struct record
|
||||
{
|
||||
std::string_view name;
|
||||
int count;
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(record, name, count)
|
||||
};
|
||||
|
||||
const std::string text = R"({"name": "widget", "count": 3})";
|
||||
const json_document doc = json_document::parse(text); // borrows text
|
||||
const record r = doc.root().get<record>(); // r.name points into text, valid while text and doc are
|
||||
```
|
||||
|
||||
!!! warning "Decoding into a `string_view` from a `json` value dangles at once"
|
||||
|
||||
The same struct also compiles with `#!cpp json::parse(text).get<record>()`, but there `name` points into the
|
||||
temporary `json` value, which is destroyed at the end of the statement. Use a named
|
||||
[`json_document`](../api/json_document.md), as above, to decode such a struct.
|
||||
|
||||
## Writing generic code
|
||||
|
||||
A view's type names its `BasicJsonType` and its [`view_mode`](../api/view_mode.md):
|
||||
[`json_view`](../api/json_view.md) is `#!cpp basic_json_view<json, view_mode::read_only>`, and
|
||||
[`json_editable_view`](../api/json_editable_view.md) is `#!cpp basic_json_view<json, view_mode::editable>`. These are
|
||||
different types. The only conversion between them turns a view of a read-only document into a view of an editable
|
||||
document of the same `BasicJsonType`, so a function written for one shortcut accepts few other views:
|
||||
|
||||
```cpp
|
||||
void print_names(json_view v); // accepts neither an ordered_json_view nor a json_editable_view
|
||||
void print_names(json_editable_view v); // also accepts a json_view, but no ordered_json_view
|
||||
```
|
||||
|
||||
This is the same pitfall as a `to_json`/`from_json` written for `json` instead of any `BasicJsonType`, which then does
|
||||
not work for `ordered_json`. The shortcuts are for declaring documents and views; a function that takes a view names
|
||||
the views it accepts with a template:
|
||||
|
||||
```cpp
|
||||
// views of editable documents only
|
||||
template<typename BasicJsonType>
|
||||
void f(basic_json_view<BasicJsonType, view_mode::editable> v);
|
||||
|
||||
// views of read-only documents only
|
||||
template<typename BasicJsonType>
|
||||
void f(basic_json_view<BasicJsonType, view_mode::read_only> v);
|
||||
|
||||
// views of either document type
|
||||
template<typename BasicJsonType, view_mode Mode>
|
||||
void f(basic_json_view<BasicJsonType, Mode> v);
|
||||
```
|
||||
|
||||
Views are passed by value: they are two pointers, cheap to copy, like a `#!cpp std::string_view`. A `const&` works as
|
||||
well, but a non-`const` reference does not bind to the views that [`root()`](../api/basic_json_document/root.md),
|
||||
[`operator[]`](../api/basic_json_view/operator%5B%5D.md), and [`at()`](../api/basic_json_view/at.md) return, so
|
||||
`#!cpp f(doc.root())` would not compile.
|
||||
|
||||
There is no conversion from an editable view to a read-only one, by design: the mode decides how a view walks the
|
||||
index. A read-only view reads a container in place, while a view of an editable document follows the links that edits
|
||||
leave behind, so a read-only view of an edited document would read stale values. The other direction is safe: a
|
||||
read-only document has no edits, so a view of it [converts](../api/basic_json_view/basic_json_view.md) to an
|
||||
editable view, which reads it like an editable document before its first edit. A template deduces the mode without
|
||||
conversions, so the template forms above still accept only the modes they name. Views of both modes compare with
|
||||
[`operator==`](../api/basic_json_view/operator_eq.md).
|
||||
|
||||
[`is_json_view<T>`](../api/is_json_view.md) tells views from other types, for constraints that cannot be written as a
|
||||
`basic_json_view<...>` parameter.
|
||||
|
||||
### A `from_json()` that reads views
|
||||
|
||||
[`get<T>()`](../api/basic_json_view/get.md) on a view calls `T`'s `from_json()` with the view itself if that
|
||||
`from_json()` accepts views, and with [`materialize()`](../api/basic_json_view/materialize.md) otherwise. The
|
||||
`from_json()` functions of the [`NLOHMANN_DEFINE_TYPE_*`](../api/macros/nlohmann_define_type_intrusive.md),
|
||||
[`NLOHMANN_DEFINE_DERIVED_TYPE_*`](../api/macros/nlohmann_define_derived_type.md), and
|
||||
[`NLOHMANN_JSON_SERIALIZE_ENUM`](../api/macros/nlohmann_json_serialize_enum.md) macros, and those of the library
|
||||
for the standard types, accept views, so these types need nothing else. For decoding the statuses of
|
||||
twitter.json into structs, reading the view is about 5 times faster than `#!cpp materialize().get<T>()`.
|
||||
|
||||
A hand-written `from_json()` reads views if it is constrained to `json` values and views:
|
||||
|
||||
```cpp
|
||||
template < typename J, typename std::enable_if <
|
||||
nlohmann::is_json_view<J>::value || std::is_same<J, nlohmann::json>::value, int >::type = 0 >
|
||||
void from_json(const J& j, person& p)
|
||||
{
|
||||
p.name = j.at("name").template get<std::string>();
|
||||
p.age = j.at("age").template get<int>();
|
||||
}
|
||||
```
|
||||
|
||||
Its body may only use what views and `basic_json` have in common: the type checks, `at()`, `operator[]`, `contains()`,
|
||||
`value()`, `size()`, iteration and `items()`, and `get<T>()`/`get_to()`. An unconstrained
|
||||
`#!cpp template<typename BasicJsonType> void from_json(const BasicJsonType& j, person& p)`, as in
|
||||
[arbitrary type conversions](arbitrary_types.md), is never called with a view, as it might use `basic_json` functions
|
||||
a view does not have; such a type is converted through `materialize()`. A `from_json()` for `json` only is
|
||||
converted through `materialize()` as well.
|
||||
|
||||
One thing differs when a `from_json()` reads the view: members looked up by name (`at()`, `value()`, ... and thus
|
||||
the macros) find the **first** member with a repeated key, see [Duplicate keys](#duplicate-keys);
|
||||
`#!cpp materialize().get<T>()` would see the last one. Containers built from an object, such as `#!cpp std::map`,
|
||||
keep the **last** value either way, as [`parse()`](../api/basic_json/parse.md) does.
|
||||
|
||||
`to_json()` is unaffected: it writes `basic_json` values, never views.
|
||||
|
||||
## Writing a view back
|
||||
|
||||
[`dump()`](../api/basic_json_view/dump.md) serializes a view directly from the flat index, without ever building a
|
||||
`basic_json` value. An object's members are written in document order, not sorted by key, and *every* occurrence of a
|
||||
repeated key is written, not only the last one — the same two ways [iteration](#what-is-different) already differs
|
||||
from a [`materialize()`](../api/basic_json_view/materialize.md)d value, see [Duplicate keys](#duplicate-keys).
|
||||
`#!cpp materialize().dump()` gives a different result in both respects for a `json_view`.
|
||||
|
||||
By default, numbers are written the way [`basic_json::dump()`](../api/basic_json/dump.md) would.
|
||||
[`number_format::source`](../api/basic_json_view/number_format.md) instead copies every number exactly as it was
|
||||
written in the source text — a price like `#!cpp 19.90`, a long order or account ID with more digits than any number
|
||||
type holds, or a high-precision coordinate — something `basic_json` cannot do at all, since parsing already reduces
|
||||
a number to its parsed `#!cpp double`/`#!cpp int64_t` value.
|
||||
|
||||
[`operator<<`](../api/basic_json_view/operator_ltlt.md) writes a view to a stream the way `basic_json`'s does, using
|
||||
the stream's `width`/`fill` for indentation.
|
||||
|
||||
## Editing a document
|
||||
|
||||
Everything above is read-only: a `json_document`/`json_view` lets you look at a parsed text without copying it, but
|
||||
not change it. [`basic_json_document<BasicJsonType, view_mode::editable>`](../api/basic_json_document/index.md) — more conveniently
|
||||
spelled [`json_editable_document`](../api/json_editable_document.md) or
|
||||
[`ordered_json_editable_document`](../api/ordered_json_editable_document.md) — also lets you
|
||||
[`set`](../api/basic_json_document/set.md) a value, [`push_back`](../api/basic_json_document/push_back.md) onto or
|
||||
[`insert`](../api/basic_json_document/insert.md) into an array, and [`erase`](../api/basic_json_document/erase.md)
|
||||
an object member or an array element, still without ever building a `basic_json` tree for parts you do not touch.
|
||||
|
||||
The [mode](../api/view_mode.md) defaults to `#!cpp view_mode::read_only`, so `json_document`/`ordered_json_document` are unaffected — they carry
|
||||
none of the bookkeeping edits need, and calling `set`/`push_back`/`insert`/`erase` on one is a compile error, not a
|
||||
runtime one.
|
||||
|
||||
### Why: editing without reformatting
|
||||
|
||||
The `#!cpp 19.90` price from [above](#writing-a-view-back) is exactly the kind of value that makes editing a `json`
|
||||
or `ordered_json` value in place lossy. Say you parse a configuration file, patch one field, and write it back:
|
||||
|
||||
- **`json`** re-sorts every key on the way in (`object_t` is a `#!cpp std::map`) and rewrites every number to its
|
||||
shortest round-trip form on the way out — a one-field patch turns into a diff that reorders the whole file and
|
||||
rewrites `#!cpp 19.90` to `#!cpp 19.9`.
|
||||
- **`ordered_json`** keeps the key order, but still rewrites every number the same way: parsing has already reduced
|
||||
it to a `#!cpp double`/`#!cpp int64_t`, and there is no way back to how it was spelled in the source text.
|
||||
|
||||
The patch of the example below (set `"host"`, add `"retries"`) written back by each of them:
|
||||
|
||||
<div class="nj-jsonview-cmp" role="group" aria-label="The same patch written back by json, ordered_json, and json_editable_document">
|
||||
<div><p class="nj-jsonview-cmp-h"><code>json</code></p><p class="nj-jsonview-cmp-v">keys sorted, numbers rewritten</p><pre>{<span class="nj-jsonview-bad">"host"</span>:"db2",
|
||||
"name":"cache",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-bad">19.9</span>,
|
||||
"retries":3}</pre></div>
|
||||
<div><p class="nj-jsonview-cmp-h"><code>ordered_json</code></p><p class="nj-jsonview-cmp-v">key order kept, numbers rewritten</p><pre>{"name":"cache",
|
||||
"host":"db2",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-bad">19.9</span>,
|
||||
"retries":3}</pre></div>
|
||||
<div class="nj-jsonview-cmp--best"><p class="nj-jsonview-cmp-h"><code>json_editable_document</code></p><p class="nj-jsonview-cmp-v">order and spelling kept</p><pre>{"name":"cache",
|
||||
"host":"db2",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-ok">19.90</span>,
|
||||
"retries":3}</pre></div>
|
||||
</div>
|
||||
|
||||
An editable document keeps both. [`dump()`](../api/basic_json_view/dump.md) of an edited document writes members in
|
||||
document order — a member [`set`](../api/basic_json_document/set.md) added goes at the end, exactly where it was
|
||||
inserted, and an [`erase`](../api/basic_json_document/erase.md)d member simply leaves a gap: everything around it
|
||||
keeps its place — and [`number_format::source`](../api/basic_json_view/number_format.md) keeps the exact spelling
|
||||
of every number an edit did not itself touch; a number an edit *did* touch is written the way
|
||||
[`BasicJsonType::dump()`](../api/basic_json/dump.md) would write it, since there is no source spelling for a brand
|
||||
new value.
|
||||
|
||||
??? example "Example: patch a configuration, keeping member order and number spellings"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_editable_document.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_editable_document.output"
|
||||
```
|
||||
|
||||
### What stays valid, and what an edit costs
|
||||
|
||||
The source text itself is **never written**, and the parsed index never moves — a value keeps the node it was
|
||||
parsed into for as long as it is not itself replaced. So every [view](../api/basic_json_view/index.md) taken before
|
||||
an edit, including a previously obtained [`root()`](../api/basic_json_document/root.md), stays valid and, if it
|
||||
still refers to the edited value, sees the edit; a view of a value a later edit drops or replaces just keeps showing
|
||||
what it last held. New values go to storage the document allocates and owns on demand. The one thing an edit does
|
||||
invalidate is the **iterators** taken over an edited array or object: the first time an element is added to it,
|
||||
inserted into it, erased from it, or replaced by a value that spans a different number of nodes, its elements move from the parsed, fixed layout to a growable block of links
|
||||
so that [`push_back`](../api/basic_json_document/push_back.md) can later grow it in amortized constant time —
|
||||
existing elements are not touched, but an iterator that was walking the old layout no longer matches. A string
|
||||
obtained with
|
||||
[`get_string()`](../api/basic_json_view/get_string.md) is unaffected either way and stays valid across further
|
||||
edits. See [`basic_json_document`'s Edits](../api/basic_json_document/index.md#edits) for the details, and
|
||||
[`set`'s Exception safety](../api/basic_json_document/set.md#exception-safety) for what an edit guarantees if it
|
||||
throws (the *basic* guarantee, not the strong one `dump()` and the read-only functions provide). How edits are kept in
|
||||
the index is described in the [architecture overview](../home/architecture.md#node-index-of-json-views).
|
||||
|
||||
Step through the edits of a small document (the node fields follow the [architecture overview](../home/architecture.md#node-index-of-json-views)):
|
||||
|
||||
<div class="nj-jsonview-steps" data-nj-jsonview-steps>
|
||||
<figure class="nj-jsonview-step" data-label="After parsing">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_0.svg"
|
||||
</div>
|
||||
<figcaption>Step 1 of 5. After parsing: nine nodes in the parsed index, no owned storage yet.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="set an existing member">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_1.svg"
|
||||
</div>
|
||||
<figcaption>Step 2 of 5. <code>doc.set(doc.root(), "port", 6380)</code> overwrites the node of the integer in place; no member is added or removed, so the object keeps its parsed layout.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="erase an array element">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_2.svg"
|
||||
</div>
|
||||
<figcaption>Step 3 of 5. <code>doc.erase(doc.root()["tags"], 0)</code>: the array is edited for the first time, so its elements move to a block of links in owned storage. The node of <code>"eu"</code> stays in the index, but nothing refers to it any more; iterators over the array taken before are invalid.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="push_back onto the array">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_3.svg"
|
||||
</div>
|
||||
<figcaption>Step 4 of 5. <code>doc.push_back(doc.root()["tags"], "new")</code>: the new string gets its own node, its text goes to the buffer of edited text, and a link to it is appended to the block of the array.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="set a new member">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_4.svg"
|
||||
</div>
|
||||
<figcaption>Step 5 of 5. <code>doc.set(doc.root(), "retries", 3)</code>: a new member, so the object moves to a block too: copies of its keys, links to the values it already had, then the new key and a link to the new integer.</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>The node index and the owned storage of the document after each of five edits. Use *Back*, *Next*, or the numbered buttons to switch between the steps; without JavaScript all steps are shown one below the other.</p>
|
||||
|
||||
## Images
|
||||
|
||||
[`save()`](../api/basic_json_document/save.md) writes a document as an *image*: a byte buffer that
|
||||
[`load()`](../api/basic_json_document/load.md) reads back into a document without parsing — no lexing, no building
|
||||
the node index, nothing but copying the nodes and pointing the text and the decoded strings at the image. Where
|
||||
[`parse_copy()`](../api/basic_json_document/parse_copy.md) still has to scan the whole input,
|
||||
[`load()`](../api/basic_json_document/load.md) turns that scan into a copy of the node index alone.
|
||||
|
||||
**Why.** A document that is parsed once and then read many times — a configuration loaded at startup, a template
|
||||
rendered on every request, a large reference dataset a worker process needs in memory — pays for parsing once but
|
||||
can amortize [`save()`](../api/basic_json_document/save.md)'s cost across every later load. That makes images useful
|
||||
for a cache: save a document the first time it is parsed (to a file, a shared-memory segment, an in-process cache),
|
||||
and [`load()`](../api/basic_json_document/load.md) it on every later use instead of parsing the source text again.
|
||||
They are just as useful for handing a parsed document to another process (or a forked worker) running the same build
|
||||
of the library, since [`load()`](../api/basic_json_document/load.md) turns the transfer into a copy of the node index
|
||||
plus pointers into the received bytes, not a re-parse.
|
||||
|
||||
**Choosing a check.** [`load()`](../api/basic_json_document/load.md) takes an
|
||||
[`image_check`](../api/basic_json_document/load.md#image_check) that trades validation against speed:
|
||||
`image_check::full` (the default) checks everything the parser itself guarantees, so a checked image is exactly as
|
||||
safe to read and serialize as a freshly parsed document — the right choice whenever the image did not come straight
|
||||
from this process's own [`save()`](../api/basic_json_document/save.md), such as a file or a network peer.
|
||||
`image_check::bounds` only checks structure and bounds — cheaper, since it skips scanning the text and the decoded
|
||||
strings — and fits a cache the process trusts, one it wrote and reads back itself. `image_check::none` skips
|
||||
validation entirely, for an image trusted as much as the process's own memory. See
|
||||
[`load()`'s Notes](../api/basic_json_document/load.md#notes) for exactly what each level does and does not guarantee.
|
||||
|
||||
??? example "Example: cache a parsed configuration as an image"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/basic_json_document__save.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/basic_json_document__save.output"
|
||||
```
|
||||
|
||||
!!! warning "Experimental"
|
||||
|
||||
The image format is versioned but not yet stable, and may change in an incompatible way before it is declared
|
||||
stable. It is little-endian only (on big-endian targets, `save()` and `load()` do not exist), and tied to the
|
||||
library build that wrote it — use it to cache a document or to hand one to another process running the *same*
|
||||
build, not as a long-term storage format; keep the original JSON text if a saved document needs to be readable by
|
||||
a future library version.
|
||||
|
||||
The idea of a document you can read without parsing comes from zero-copy formats such as
|
||||
[FlatBuffers](https://github.com/google/flatbuffers) and [YaFF](https://github.com/yandex/yaff); the check
|
||||
[`load()`](../api/basic_json_document/load.md) runs follows the idea of FlatBuffers' Verifier. No code is taken from
|
||||
either.
|
||||
|
||||
## Choosing between `json`, `ordered_json`, the SAX interface, and `json_view`
|
||||
|
||||
| | [`json`](../api/json.md) / [`ordered_json`](../api/ordered_json.md) | [SAX interface](parsing/sax_interface.md) | [`json_document`](../api/json_document.md) / [`json_view`](../api/json_view.md) | [`json_editable_document`](../api/json_editable_document.md) / [`json_editable_view`](../api/json_editable_view.md) |
|
||||
|---|---|---|---|---|
|
||||
| **Ownership** | owns every value | owns nothing; you decide what to keep, in your handler | borrows or owns the *text*; the index is always owned by the document | same as `json_document`; edits go to storage the document owns |
|
||||
| **Mutability** | freely mutable | not applicable (a one-shot event stream) | read-only | [`set`](../api/basic_json_document/set.md)/[`push_back`](../api/basic_json_document/push_back.md)/[`insert`](../api/basic_json_document/insert.md)/[`erase`](../api/basic_json_document/erase.md) edit in place; the source text is never rewritten |
|
||||
| **What you get** | a full tree you can read, write, and keep as long as you like | a sequence of callbacks; whatever your handler builds from them | a flat index plus, on demand, [`materialize()`](../api/basic_json_view/materialize.md)d `json`/`ordered_json` values for the parts you actually use | the same, plus [`dump()`](../api/basic_json_view/dump.md) of an edited document that keeps the member order and, with [`number_format::source`](../api/basic_json_view/number_format.md), the spelling of every untouched number |
|
||||
| **Typical use** | general-purpose JSON handling: config, request/response bodies you build or modify, anything you hold onto | validating or projecting a text into your own data structure without ever holding the whole thing as JSON | large or high-volume input where you only need part of it, or need it repeatedly, and can keep the source text (or a copy) alive for as long as the document lives | a document you read, patch a few fields of, and write back — a configuration file, for instance — where the rest of it should come back exactly as it was |
|
||||
| **Caching/reload** | not applicable — re-parse, or roll your own serialization | not applicable | [`save()`](../api/basic_json_document/save.md)/[`load()`](../api/basic_json_document/load.md): cache the parsed index as an image and reload it without parsing | same, saving the document's current — possibly edited — state |
|
||||
|
||||
<p class="nj-table-caption" markdown>Each column is one way to work with JSON in this library, and each row compares one property of them.</p>
|
||||
|
||||
## See also
|
||||
|
||||
- [`basic_json_document`](../api/basic_json_document/index.md) - the document that owns the parsed index (parse, access, images, edits)
|
||||
- [`basic_json_view`](../api/basic_json_view/index.md) - the non-owning handle to a value in a document
|
||||
- [`json_document`](../api/json_document.md) - and [`ordered_json_document`](../api/ordered_json_document.md) - the read-only documents
|
||||
- [`json_editable_document`](../api/json_editable_document.md) - and [`ordered_json_editable_document`](../api/ordered_json_editable_document.md) - the documents that can be edited in place
|
||||
- [Architecture](../home/architecture.md#node-index-of-json-views) - the layout of the node index
|
||||
- [SAX interface](parsing/sax_interface.md) - event-based parsing without building a tree
|
||||
- [Performance](performance.md) - benchmarks and tuning of parsing and serialization
|
||||
- [Large, Streamed, and Partial Input](parsing/large_and_partial_input.md) - reading only the part of a text you need
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,220 @@
|
||||
# Differences from `basic_json`
|
||||
|
||||
A [`basic_json_view`](../../api/basic_json_view/index.md) offers the read-only part of the
|
||||
[`basic_json`](../../api/basic_json/index.md) interface, and in most respects it behaves exactly like the value
|
||||
[`basic_json::parse()`](../../api/basic_json/parse.md) would have built from the same text. This page lists where it
|
||||
does not: what a document parses differently, what a view's functions do differently, and which parts of the
|
||||
`basic_json` interface a view does not have.
|
||||
|
||||
## Summary
|
||||
|
||||
| | `basic_json` value from `parse()` | view of a `json_document` | to get the `basic_json` behavior |
|
||||
|---|---|---|---|
|
||||
| [Integer types](#parsing) | any `number_integer_t`/`number_unsigned_t` | 64-bit only (compile-time check) | — |
|
||||
| [Input size](#parsing) | unlimited | less than 4 GiB | — |
|
||||
| [Parser callbacks](#parsing) | `parser_callback_t` | none | filter while iterating |
|
||||
| [`operator[]` on a missing key or index](#element-access) | inserts (non-`const`) or undefined behavior (`const`) | returns a discarded view | — |
|
||||
| [Object member order](#object-member-order) | sorted by key (`json`), insertion order (`ordered_json`) | document order | `materialize()` |
|
||||
| [Repeated keys](#duplicate-keys) | the last value is kept | lookups find the first member; iteration, `size()`, and `dump()` see all of them | `materialize()` |
|
||||
| [Conversions](#conversions) | `get<T>()`, implicit conversions, `get_ptr()`, `get_ref()` | `get<T>()`, `get_string()`, `number_token()` | `materialize()` |
|
||||
| [Number spelling](#serialization) | lost when parsing | kept: `number_token()`, `number_format::source` | — |
|
||||
| [Comparison](#comparison) | `==`, `!=`, `<`, `<=>`, ... | `==` and `!=` only | `materialize()` |
|
||||
| [Modification](#what-a-view-does-not-have) | member functions of the value | only through an [editable document](editing.md) | `materialize()` |
|
||||
| [Iterators](#what-a-view-does-not-have) | bidirectional (`rbegin()`/`rend()`) | forward only | `materialize()` |
|
||||
|
||||
<p class="nj-table-caption" markdown>Each row is one difference; the last column names the way to get `basic_json`'s behavior from a view, where there is one.</p>
|
||||
|
||||
## Parsing
|
||||
|
||||
### What is the same
|
||||
|
||||
- **Accept/reject.** [`accept()`](../../api/basic_json_document/accept.md) and
|
||||
[`parse()`](../../api/basic_json_document/parse.md) accept and reject exactly the same inputs as
|
||||
[`basic_json::accept()`](../../api/basic_json/accept.md)/[`basic_json::parse()`](../../api/basic_json/parse.md),
|
||||
with the same `ignore_comments` and `ignore_trailing_commas` options.
|
||||
- **Errors.** A failing parse throws the same exception — the same id, message, and position — because on failure
|
||||
the library's own parser is run on the same bytes to produce the diagnostic. Valid input never pays for this, and
|
||||
the replay builds no values: it costs about a lexing pass up to the error.
|
||||
`#!cpp allow_exceptions == false` skips the replay and gives a
|
||||
[discarded](../../api/basic_json_document/is_discarded.md) document instead of throwing, just as it gives a
|
||||
discarded value for `#!cpp basic_json::parse()`.
|
||||
- **Number classification.** An integer literal that does not fit into the 64-bit integer type becomes a
|
||||
floating-point value, exactly as it does for `#!cpp basic_json::parse()`.
|
||||
- **Macros.** [`JSON_STRICT_NUL_HANDLING`](../../api/macros/json_strict_nul_handling.md) and
|
||||
[`JSON_NOEXCEPTION`](../../api/macros/json_noexception.md)/[`JSON_THROW_USER`](../../api/macros/json_throw_user.md)
|
||||
behave the same way they do for `<nlohmann/json.hpp>`. These are the macros that change what the parser accepts or
|
||||
how it reports errors. The other macros only affect the values `materialize()` produces, through `BasicJsonType`.
|
||||
Two of them also add context to the exceptions of views, see [Exception context](#exception-context).
|
||||
|
||||
### What is different
|
||||
|
||||
- **Only 64-bit integers.** `basic_json_document<BasicJsonType>` requires `BasicJsonType::number_integer_t` and
|
||||
`number_unsigned_t` to both be 64 bits wide; this is a compile-time `#!cpp static_assert`.
|
||||
- **A 4 GiB input limit.** An input of 4294967280 bytes (4 GiB minus 16 bytes) or more throws
|
||||
[`out_of_range.416`](../../home/exceptions.md#jsonexceptionout_of_range416), a limit
|
||||
`#!cpp basic_json::parse()` does not have. It keeps an index entry at 16 bytes: offsets and counts are 32 bits
|
||||
wide. The limit is 16 bytes below 2^32, because the parser reads in 16-byte steps, and a position one step past the
|
||||
end must still fit.
|
||||
- **A stream is always read to its end.** There is no partial/streaming read of an `#!cpp std::istream`: the stream
|
||||
is read to its end into a buffer the document owns, and parsing starts after that. For a file, reading it into a
|
||||
`#!cpp std::string` yourself and parsing that (an lvalue is borrowed) is therefore not more expensive in memory, and
|
||||
was about 6 to 12 % faster than parsing from an `#!cpp std::ifstream`.
|
||||
- **No parser callbacks.** [`parse()`](../../api/basic_json_document/parse.md) takes no
|
||||
[`parser_callback_t`](../../api/basic_json/parser_callback_t.md): a document always indexes the whole text. Skip
|
||||
the values you do not need when reading the view instead.
|
||||
- **JSON text only.** A document is parsed from JSON text; there is no counterpart of
|
||||
[`from_cbor()`](../../api/basic_json/from_cbor.md) and the other binary formats, and
|
||||
[`is_binary()`](../../api/basic_json_view/is_binary.md) is always `#!cpp false`.
|
||||
|
||||
## Element access
|
||||
|
||||
**Chained access is safe.** [`operator[]`](../../api/basic_json_view/operator%5B%5D.md) with a missing key, an index
|
||||
out of range, or an unresolvable JSON pointer returns a [discarded](../../api/basic_json_view/is_discarded.md) view,
|
||||
and `operator[]` on a discarded view returns a discarded view without throwing: `#!cpp v["a"]["b"][0]` can be tested
|
||||
once at the end. Type errors on values that exist (a key on an array, an index on an object) still throw, and
|
||||
[`at`](../../api/basic_json_view/at.md) throws for every missing value.
|
||||
|
||||
`basic_json`'s non-`const` `operator[]` instead inserts a missing key, and its `const` `operator[]` has undefined
|
||||
behavior for one.
|
||||
|
||||
## Objects
|
||||
|
||||
### Object member order
|
||||
|
||||
[`begin()`](../../api/basic_json_view/begin.md)/[`end()`](../../api/basic_json_view/end.md) and
|
||||
[`items()`](../../api/basic_json_view/items.md) visit an object's members in the order they appear in the source text.
|
||||
`basic_json`'s default `object_t` is a `std::map`, which sorts by key, so iterating a
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md)d value can print members in a different order than
|
||||
iterating the view they came from. [`dump()`](../../api/basic_json_view/dump.md) of a view writes members in document
|
||||
order as well.
|
||||
|
||||
### Duplicate keys
|
||||
|
||||
!!! warning "A lookup in a view and in the parsed value can give different answers"
|
||||
|
||||
If an object in the source text repeats a key, [`operator[]`](../../api/basic_json_view/operator%5B%5D.md),
|
||||
[`at`](../../api/basic_json_view/at.md), [`find`](../../api/basic_json_view/find.md),
|
||||
[`value`](../../api/basic_json_view/value.md), [`contains`](../../api/basic_json_view/contains.md), and JSON
|
||||
pointer resolution all return the **first** member with that key. `basic_json::parse()` instead keeps the **last**
|
||||
value of a repeated key, so for `#!cpp {"a":1,"a":2}`, `#!cpp view["a"]` is `#!cpp 1` while
|
||||
`#!cpp parse(text)["a"]` is `#!cpp 2`. [`count`](../../api/basic_json_view/count.md) counts every member with the
|
||||
key, so it is `#!cpp 2` here.
|
||||
|
||||
[`begin()`](../../api/basic_json_view/begin.md)/[`end()`](../../api/basic_json_view/end.md) and
|
||||
[`items()`](../../api/basic_json_view/items.md) visit *every* occurrence, in document order, and
|
||||
[`size()`](../../api/basic_json_view/size.md) counts all of them, so `#!cpp view.size()` can be larger than
|
||||
`#!cpp view.materialize().size()`. [`dump()`](../../api/basic_json_view/dump.md) writes every occurrence, too, so
|
||||
`#!cpp materialize().dump()` gives a different result for such an object.
|
||||
|
||||
**Why the first?** A lookup can stop as soon as it finds a match. Returning the last member would force every lookup
|
||||
to scan all members of the object, even when the key is found at the very first one: this made lookups in small
|
||||
objects 1.6 to 3.4 times slower. The hash index of the keys of objects with 128 members or more leads to the first
|
||||
member of a key as well. Other zero-copy parsers that index the source text, such as yyjson and simdjson, also return
|
||||
the first member. RFC 8259 only says that names within an object SHOULD be unique and that the behavior of a receiver
|
||||
that sees duplicates is unpredictable, so neither choice is wrong.
|
||||
|
||||
The same holds for [`get<T>()`](../../api/basic_json_view/get.md) of a type whose `from_json()` reads the view, such
|
||||
as the types of the `NLOHMANN_DEFINE_TYPE_*` macros: their members are looked up, so `#!cpp get<point>()` of
|
||||
`#!cpp {"x":1,"x":2}` reads `#!cpp x == 1`, while `#!cpp materialize().get<point>()` reads `#!cpp 2`.
|
||||
|
||||
**What stays the same as `parse()`?** [`materialize()`](../../api/basic_json_view/materialize.md) and
|
||||
[`get<std::map<...>>()`](../../api/basic_json_view/get.md) (and the other containers built from an object) replay
|
||||
every member in order, so they keep the *last* value exactly like `#!cpp basic_json::parse()` (at the position of the
|
||||
first occurrence of the key, for an [`ordered_json`](../../api/ordered_json.md)).
|
||||
|
||||
**How do I get the value `parse()` would give?** Either call `#!cpp view.materialize()` and look the key up in the
|
||||
result, or iterate the members and keep the last match:
|
||||
|
||||
```cpp
|
||||
// the last member with the key "a", as parse() would keep it
|
||||
json_view last;
|
||||
for (const auto item : view.items())
|
||||
{
|
||||
if (item.key() == "a")
|
||||
{
|
||||
last = item.value();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
If you cannot trust the source text to have unique keys, check [`size()`](../../api/basic_json_view/size.md) against
|
||||
the number of distinct keys, or reject duplicates when iterating.
|
||||
|
||||
## Conversions
|
||||
|
||||
- **No implicit conversions.** A view has no `#!cpp operator ValueType()`, no `#!cpp get_ptr()`, and no
|
||||
`#!cpp get_ref()`; use [`get<T>()`](../../api/basic_json_view/get.md), or
|
||||
[`get_string()`](../../api/basic_json_view/get_string.md) for a string without a copy.
|
||||
- **`from_json()` overloads.** [`get<T>()`](../../api/basic_json_view/get.md) calls `T`'s `from_json()` with the view
|
||||
only if that `from_json()` accepts views, and with [`materialize()`](../../api/basic_json_view/materialize.md)
|
||||
otherwise; see [A `from_json()` that reads views](generic_code.md#a-from_json-that-reads-views). Both give the same
|
||||
result except for [repeated keys](#duplicate-keys).
|
||||
- **`string_view` members.** A struct with a `#!cpp std::string_view` member decoded from a view points into the
|
||||
document, see [`string_view` members](reading.md#string_view-members). Decoding the same struct from a `json` value
|
||||
compiles, too, but dangles at once if the value is a temporary.
|
||||
|
||||
## Serialization
|
||||
|
||||
[`dump()`](../../api/basic_json_view/dump.md) writes numbers the way
|
||||
[`basic_json::dump()`](../../api/basic_json/dump.md) would by default, but writes object members in
|
||||
[document order](#object-member-order) and writes [every occurrence of a repeated key](#duplicate-keys).
|
||||
|
||||
A view can also do what a `basic_json` value cannot: [`number_token()`](../../api/basic_json_view/number_token.md)
|
||||
and [`number_format::source`](../../api/basic_json_view/number_format.md) give every number exactly as it was spelled
|
||||
in the source text, while parsing into `basic_json` already reduces a number to its `#!cpp double`/`#!cpp int64_t`
|
||||
value. See [Writing a view back](reading.md#writing-a-view-back).
|
||||
|
||||
## Comparison
|
||||
|
||||
**Ordering comparisons are not provided** by `basic_json_view` — there is no `#!cpp operator<`.
|
||||
[`operator==`](../../api/basic_json_view/operator_eq.md) and [`operator!=`](../../api/basic_json_view/operator_ne.md)
|
||||
are provided, though: two views, or a view and a `BasicJsonType` value, compare equal exactly when
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) or [`parse()`](../../api/basic_json/parse.md) would produce
|
||||
equal values for them, without ever building a tree to do it. For ordering,
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) is the way to get a value you can compare.
|
||||
|
||||
## Exception context
|
||||
|
||||
With [`JSON_DIAGNOSTICS`](../../api/macros/json_diagnostics.md), an exception of a view names the JSON Pointer path of
|
||||
the value within the document, and with
|
||||
[`JSON_DIAGNOSTIC_POSITIONS`](../../api/macros/json_diagnostic_positions.md), it names the bytes of the value in the
|
||||
source text, as they do for the exceptions of `#!cpp basic_json`.
|
||||
|
||||
A view has neither parent pointers nor stored positions, so both are found from the document's index when the
|
||||
exception is thrown. This takes time linear in the size of the document. One exception has neither: `key()` of an
|
||||
iterator over an array or a primitive value
|
||||
([`invalid_iterator.207`](../../home/exceptions.md#jsonexceptioninvalid_iterator207)), because a view's iterator does
|
||||
not know the value it iterates over.
|
||||
|
||||
**Fewer source positions after edits.** With
|
||||
[`JSON_DIAGNOSTIC_POSITIONS`](../../api/macros/json_diagnostic_positions.md) enabled,
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) sets the same positions as `#!cpp basic_json::parse()`. In
|
||||
an [editable document](editing.md), a value written by an edit has none, and neither has an array or object whose
|
||||
elements changed or whose last element has none; a `basic_json` value keeps its positions when it is changed. See
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md#notes).
|
||||
|
||||
## What a view does not have
|
||||
|
||||
A view is a read-only handle. These parts of the `basic_json` interface have no counterpart on a view;
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) the subtree to use them:
|
||||
|
||||
- **Modifiers** such as `push_back`, `insert`, `erase`, `update`, or `operator=`. A view never changes a value
|
||||
itself; an [editable document](editing.md) changes the values its views refer to through
|
||||
[`set`](../../api/basic_json_document/set.md), [`push_back`](../../api/basic_json_document/push_back.md),
|
||||
[`insert`](../../api/basic_json_document/insert.md), and [`erase`](../../api/basic_json_document/erase.md).
|
||||
- **Reverse iteration.** A view's iterator is a forward iterator; there is no `rbegin()`/`rend()`.
|
||||
- **JSON Patch and friends**: [`patch()`](../../api/basic_json/patch.md),
|
||||
[`merge_patch()`](../../api/basic_json/merge_patch.md), [`diff()`](../../api/basic_json/diff.md),
|
||||
[`flatten()`](../../api/basic_json/flatten.md).
|
||||
- **Binary formats**: [`to_cbor()`](../../api/basic_json/to_cbor.md) and the other writers, and binary values
|
||||
([`get_binary()`](../../api/basic_json/get_binary.md)).
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`basic_json_view`](../../api/basic_json_view/index.md) - the full interface of a view
|
||||
- [`materialize()`](../../api/basic_json_view/materialize.md) - build the `basic_json` value of a view
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,133 @@
|
||||
# Editing a document
|
||||
|
||||
A [`json_document`](../../api/json_document.md)/[`json_view`](../../api/json_view.md) lets you look at a parsed text
|
||||
without copying it, but not change it.
|
||||
[`basic_json_document<BasicJsonType, view_mode::editable>`](../../api/basic_json_document/index.md) — more
|
||||
conveniently spelled [`json_editable_document`](../../api/json_editable_document.md) or
|
||||
[`ordered_json_editable_document`](../../api/ordered_json_editable_document.md) — also lets you
|
||||
[`set`](../../api/basic_json_document/set.md) a value, [`push_back`](../../api/basic_json_document/push_back.md) onto
|
||||
or [`insert`](../../api/basic_json_document/insert.md) into an array, and
|
||||
[`erase`](../../api/basic_json_document/erase.md) an object member or an array element, still without ever building a
|
||||
`basic_json` tree for parts you do not touch.
|
||||
|
||||
The [mode](../../api/view_mode.md) defaults to `#!cpp view_mode::read_only`, so
|
||||
`json_document`/`ordered_json_document` are unaffected — they carry none of the bookkeeping edits need, and calling
|
||||
`set`/`push_back`/`insert`/`erase` on one is a compile error, not a runtime one.
|
||||
|
||||
## Why: editing without reformatting
|
||||
|
||||
A price like `#!cpp 19.90` is exactly the kind of value that makes editing a `json` or `ordered_json` value in place
|
||||
lossy. Say you parse a configuration file, patch one field, and write it back:
|
||||
|
||||
- **`json`** re-sorts every key on the way in (`object_t` is a `#!cpp std::map`) and rewrites every number to its
|
||||
shortest round-trip form on the way out — a one-field patch turns into a diff that reorders the whole file and
|
||||
rewrites `#!cpp 19.90` to `#!cpp 19.9`.
|
||||
- **`ordered_json`** keeps the key order, but still rewrites every number the same way: parsing has already reduced
|
||||
it to a `#!cpp double`/`#!cpp int64_t`, and there is no way back to how it was spelled in the source text.
|
||||
|
||||
The patch of the example below (set `"host"`, add `"retries"`) written back by each of them:
|
||||
|
||||
<div class="nj-jsonview-cmp" role="group" aria-label="The same patch written back by json, ordered_json, and json_editable_document">
|
||||
<div><p class="nj-jsonview-cmp-h"><code>json</code></p><p class="nj-jsonview-cmp-v">keys sorted, numbers rewritten</p><pre>{<span class="nj-jsonview-bad">"host"</span>:"db2",
|
||||
"name":"cache",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-bad">19.9</span>,
|
||||
"retries":3}</pre></div>
|
||||
<div><p class="nj-jsonview-cmp-h"><code>ordered_json</code></p><p class="nj-jsonview-cmp-v">key order kept, numbers rewritten</p><pre>{"name":"cache",
|
||||
"host":"db2",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-bad">19.9</span>,
|
||||
"retries":3}</pre></div>
|
||||
<div class="nj-jsonview-cmp--best"><p class="nj-jsonview-cmp-h"><code>json_editable_document</code></p><p class="nj-jsonview-cmp-v">order and spelling kept</p><pre>{"name":"cache",
|
||||
"host":"db2",
|
||||
"port":6379,
|
||||
"price":<span class="nj-jsonview-ok">19.90</span>,
|
||||
"retries":3}</pre></div>
|
||||
</div>
|
||||
|
||||
An editable document keeps both. [`dump()`](../../api/basic_json_view/dump.md) of an edited document writes members in
|
||||
document order — a member [`set`](../../api/basic_json_document/set.md) added goes at the end, exactly where it was
|
||||
inserted, and an [`erase`](../../api/basic_json_document/erase.md)d member simply leaves a gap: everything around it
|
||||
keeps its place — and [`number_format::source`](../../api/basic_json_view/number_format.md) keeps the exact spelling
|
||||
of every number an edit did not itself touch; a number an edit *did* touch is written the way
|
||||
[`BasicJsonType::dump()`](../../api/basic_json/dump.md) would write it, since there is no source spelling for a brand
|
||||
new value. See [Writing a view back](reading.md#writing-a-view-back).
|
||||
|
||||
??? example "Example: patch a configuration, keeping member order and number spellings"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_editable_document.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_editable_document.output"
|
||||
```
|
||||
|
||||
## What stays valid, and what an edit costs
|
||||
|
||||
The source text itself is **never written**, and the parsed index never moves — a value keeps the node it was
|
||||
parsed into for as long as it is not itself replaced. So every [view](../../api/basic_json_view/index.md) taken before
|
||||
an edit, including a previously obtained [`root()`](../../api/basic_json_document/root.md), stays valid and, if it
|
||||
still refers to the edited value, sees the edit; a view of a value a later edit drops or replaces just keeps showing
|
||||
what it last held. New values go to storage the document allocates and owns on demand. The one thing an edit does
|
||||
invalidate is the **iterators** taken over an edited array or object: the first time an element is added to it,
|
||||
inserted into it, erased from it, or replaced by a value that spans a different number of nodes, its elements move
|
||||
from the parsed, fixed layout to a growable block of links so that
|
||||
[`push_back`](../../api/basic_json_document/push_back.md) can later grow it in amortized constant time — existing
|
||||
elements are not touched, but an iterator that was walking the old layout no longer matches. A string obtained with
|
||||
[`get_string()`](../../api/basic_json_view/get_string.md) is unaffected either way and stays valid across further
|
||||
edits. See [`basic_json_document`'s Edits](../../api/basic_json_document/index.md#edits) for the details, and
|
||||
[`set`'s Exception safety](../../api/basic_json_document/set.md#exception-safety) for what an edit guarantees if it
|
||||
throws (the *basic* guarantee, not the strong one `dump()` and the read-only functions provide). How edits are kept in
|
||||
the index is described in the [architecture overview](../../home/architecture.md#node-index-of-json-views).
|
||||
|
||||
Step through the edits of a small document (the node fields follow the
|
||||
[architecture overview](../../home/architecture.md#node-index-of-json-views)):
|
||||
|
||||
<div class="nj-jsonview-steps" data-nj-jsonview-steps>
|
||||
<figure class="nj-jsonview-step" data-label="After parsing">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_0.svg"
|
||||
</div>
|
||||
<figcaption>Step 1 of 5. After parsing: nine nodes in the parsed index, no owned storage yet.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="set an existing member">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_1.svg"
|
||||
</div>
|
||||
<figcaption>Step 2 of 5. <code>doc.set(doc.root(), "port", 6380)</code> overwrites the node of the integer in place; no member is added or removed, so the object keeps its parsed layout.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="erase an array element">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_2.svg"
|
||||
</div>
|
||||
<figcaption>Step 3 of 5. <code>doc.erase(doc.root()["tags"], 0)</code>: the array is edited for the first time, so its elements move to a block of links in owned storage. The node of <code>"eu"</code> stays in the index, but nothing refers to it any more; iterators over the array taken before are invalid.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="push_back onto the array">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_3.svg"
|
||||
</div>
|
||||
<figcaption>Step 4 of 5. <code>doc.push_back(doc.root()["tags"], "new")</code>: the new string gets its own node, its text goes to the buffer of edited text, and a link to it is appended to the block of the array.</figcaption>
|
||||
</figure>
|
||||
<figure class="nj-jsonview-step" data-label="set a new member">
|
||||
<div class="nj-jsonview-scroll">
|
||||
--8<-- "images/json_view_edit_4.svg"
|
||||
</div>
|
||||
<figcaption>Step 5 of 5. <code>doc.set(doc.root(), "retries", 3)</code>: a new member, so the object moves to a block too: copies of its keys, links to the values it already had, then the new key and a link to the new integer.</figcaption>
|
||||
</figure>
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>The node index and the owned storage of the document after each of five edits. Use *Back*, *Next*, or the numbered buttons to switch between the steps; without JavaScript all steps are shown one below the other.</p>
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`json_editable_document`](../../api/json_editable_document.md) - and [`ordered_json_editable_document`](../../api/ordered_json_editable_document.md) - the documents that can be edited in place
|
||||
- [`basic_json_document`'s Edits](../../api/basic_json_document/index.md#edits) - the rules of edits in detail
|
||||
- [Differences from `basic_json`](differences.md#exception-context) - source positions after edits
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,93 @@
|
||||
# Writing generic code
|
||||
|
||||
## View types
|
||||
|
||||
A view's type names its `BasicJsonType` and its [`view_mode`](../../api/view_mode.md):
|
||||
[`json_view`](../../api/json_view.md) is `#!cpp basic_json_view<json, view_mode::read_only>`, and
|
||||
[`json_editable_view`](../../api/json_editable_view.md) is `#!cpp basic_json_view<json, view_mode::editable>`. These
|
||||
are different types. The only conversion between them turns a view of a read-only document into a view of an
|
||||
editable document of the same `BasicJsonType`, so a function written for one shortcut accepts few other views:
|
||||
|
||||
```cpp
|
||||
void print_names(json_view v); // accepts neither an ordered_json_view nor a json_editable_view
|
||||
void print_names(json_editable_view v); // also accepts a json_view, but no ordered_json_view
|
||||
```
|
||||
|
||||
This is the same pitfall as a `to_json`/`from_json` written for `json` instead of any `BasicJsonType`, which then does
|
||||
not work for `ordered_json`. The shortcuts are for declaring documents and views; a function that takes a view names
|
||||
the views it accepts with a template:
|
||||
|
||||
```cpp
|
||||
// views of editable documents only
|
||||
template<typename BasicJsonType>
|
||||
void f(basic_json_view<BasicJsonType, view_mode::editable> v);
|
||||
|
||||
// views of read-only documents only
|
||||
template<typename BasicJsonType>
|
||||
void f(basic_json_view<BasicJsonType, view_mode::read_only> v);
|
||||
|
||||
// views of either document type
|
||||
template<typename BasicJsonType, view_mode Mode>
|
||||
void f(basic_json_view<BasicJsonType, Mode> v);
|
||||
```
|
||||
|
||||
Views are passed by value: they are two pointers, cheap to copy, like a `#!cpp std::string_view`. A `const&` works as
|
||||
well, but a non-`const` reference does not bind to the views that
|
||||
[`root()`](../../api/basic_json_document/root.md), [`operator[]`](../../api/basic_json_view/operator%5B%5D.md), and
|
||||
[`at()`](../../api/basic_json_view/at.md) return, so `#!cpp f(doc.root())` would not compile.
|
||||
|
||||
There is no conversion from an editable view to a read-only one, by design: the mode decides how a view walks the
|
||||
index. A read-only view reads a container in place, while a view of an editable document follows the links that edits
|
||||
leave behind, so a read-only view of an edited document would read stale values. The other direction is safe: a
|
||||
read-only document has no edits, so a view of it [converts](../../api/basic_json_view/basic_json_view.md) to an
|
||||
editable view, which reads it like an editable document before its first edit. A template deduces the mode without
|
||||
conversions, so the template forms above still accept only the modes they name. Views of both modes compare with
|
||||
[`operator==`](../../api/basic_json_view/operator_eq.md).
|
||||
|
||||
[`is_json_view<T>`](../../api/is_json_view.md) tells views from other types, for constraints that cannot be written as
|
||||
a `basic_json_view<...>` parameter.
|
||||
|
||||
## A `from_json()` that reads views
|
||||
|
||||
[`get<T>()`](../../api/basic_json_view/get.md) on a view calls `T`'s `from_json()` with the view itself if that
|
||||
`from_json()` accepts views, and with [`materialize()`](../../api/basic_json_view/materialize.md) otherwise. The
|
||||
`from_json()` functions of the [`NLOHMANN_DEFINE_TYPE_*`](../../api/macros/nlohmann_define_type_intrusive.md),
|
||||
[`NLOHMANN_DEFINE_DERIVED_TYPE_*`](../../api/macros/nlohmann_define_derived_type.md), and
|
||||
[`NLOHMANN_JSON_SERIALIZE_ENUM`](../../api/macros/nlohmann_json_serialize_enum.md) macros, and those of the library
|
||||
for the standard types, accept views, so these types need nothing else. For decoding the statuses of
|
||||
twitter.json into structs, reading the view is about 5 times faster than `#!cpp materialize().get<T>()`.
|
||||
|
||||
A hand-written `from_json()` reads views if it is constrained to `json` values and views:
|
||||
|
||||
```cpp
|
||||
template < typename J, typename std::enable_if <
|
||||
nlohmann::is_json_view<J>::value || std::is_same<J, nlohmann::json>::value, int >::type = 0 >
|
||||
void from_json(const J& j, person& p)
|
||||
{
|
||||
p.name = j.at("name").template get<std::string>();
|
||||
p.age = j.at("age").template get<int>();
|
||||
}
|
||||
```
|
||||
|
||||
Its body may only use what views and `basic_json` have in common: the type checks, `at()`, `operator[]`,
|
||||
`contains()`, `value()`, `size()`, iteration and `items()`, and `get<T>()`/`get_to()`. An unconstrained
|
||||
`#!cpp template<typename BasicJsonType> void from_json(const BasicJsonType& j, person& p)`, as in
|
||||
[arbitrary type conversions](../arbitrary_types.md), is never called with a view, as it might use `basic_json`
|
||||
functions a view does not have; such a type is converted through `materialize()`. A `from_json()` for `json` only is
|
||||
converted through `materialize()` as well.
|
||||
|
||||
Reading the view and `#!cpp materialize().get<T>()` give the same result, except for an object with a repeated key;
|
||||
see [Duplicate keys](differences.md#duplicate-keys).
|
||||
|
||||
`to_json()` is unaffected: it writes `basic_json` values, never views.
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`is_json_view`](../../api/is_json_view.md) - type trait to detect views
|
||||
- [`view_mode`](../../api/view_mode.md) - read-only and editable views
|
||||
- [Reading values](reading.md) - what `get<T>()` converts without materializing
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,70 @@
|
||||
# Images
|
||||
|
||||
[`save()`](../../api/basic_json_document/save.md) writes a document as an *image*: a byte buffer that
|
||||
[`load()`](../../api/basic_json_document/load.md) reads back into a document without parsing — no lexing, no building
|
||||
the node index, nothing but copying the nodes and pointing the text and the decoded strings at the image. Where
|
||||
[`parse_copy()`](../../api/basic_json_document/parse_copy.md) still has to scan the whole input,
|
||||
[`load()`](../../api/basic_json_document/load.md) turns that scan into a copy of the node index alone.
|
||||
|
||||
## Why
|
||||
|
||||
A document that is parsed once and then read many times — a configuration loaded at startup, a template rendered on
|
||||
every request, a large reference dataset a worker process needs in memory — pays for parsing once but can amortize
|
||||
[`save()`](../../api/basic_json_document/save.md)'s cost across every later load. That makes images useful for a
|
||||
cache: save a document the first time it is parsed (to a file, a shared-memory segment, an in-process cache), and
|
||||
[`load()`](../../api/basic_json_document/load.md) it on every later use instead of parsing the source text again.
|
||||
They are just as useful for handing a parsed document to another process (or a forked worker) running the same build
|
||||
of the library, since [`load()`](../../api/basic_json_document/load.md) turns the transfer into a copy of the node
|
||||
index plus pointers into the received bytes, not a re-parse.
|
||||
|
||||
## Choosing a check
|
||||
|
||||
[`load()`](../../api/basic_json_document/load.md) takes an
|
||||
[`image_check`](../../api/basic_json_document/load.md#image_check) that trades validation against speed:
|
||||
|
||||
- `image_check::full` (the default) checks everything the parser itself guarantees, so a checked image is exactly as
|
||||
safe to read and serialize as a freshly parsed document — the right choice whenever the image did not come straight
|
||||
from this process's own [`save()`](../../api/basic_json_document/save.md), such as a file or a network peer.
|
||||
- `image_check::bounds` only checks structure and bounds — cheaper, since it skips scanning the text and the decoded
|
||||
strings — and fits a cache the process trusts, one it wrote and reads back itself.
|
||||
- `image_check::none` skips validation entirely, for an image trusted as much as the process's own memory.
|
||||
|
||||
See [`load()`'s Notes](../../api/basic_json_document/load.md#notes) for exactly what each level does and does not
|
||||
guarantee.
|
||||
|
||||
??? example "Example: cache a parsed configuration as an image"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/basic_json_document__save.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/basic_json_document__save.output"
|
||||
```
|
||||
|
||||
!!! warning "Experimental"
|
||||
|
||||
The image format is versioned but not yet stable, and may change in an incompatible way before it is declared
|
||||
stable. It is little-endian only (on big-endian targets, `save()` and `load()` do not exist), and tied to the
|
||||
library build that wrote it — use it to cache a document or to hand one to another process running the *same*
|
||||
build, not as a long-term storage format; keep the original JSON text if a saved document needs to be readable by
|
||||
a future library version.
|
||||
|
||||
## Credits
|
||||
|
||||
The idea of a document you can read without parsing comes from zero-copy formats such as
|
||||
[FlatBuffers](https://github.com/google/flatbuffers) and [YaFF](https://github.com/yandex/yaff); the check
|
||||
[`load()`](../../api/basic_json_document/load.md) runs follows the idea of FlatBuffers' Verifier. No code is taken from
|
||||
either.
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`save()`](../../api/basic_json_document/save.md) - write a document as an image
|
||||
- [`load()`](../../api/basic_json_document/load.md) - read an image back into a document
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,106 @@
|
||||
# Zero-copy JSON views
|
||||
|
||||
`#!cpp <nlohmann/json_view.hpp>` adds a read-only, non-owning way to look at a parsed JSON text, as an alternative to
|
||||
building a [`basic_json`](../../api/basic_json/index.md) tree with [`parse()`](../../api/basic_json/parse.md).
|
||||
|
||||
## The problem
|
||||
|
||||
[`basic_json::parse()`](../../api/basic_json/parse.md) builds a tree of `basic_json` values: one allocation for every
|
||||
array and object, and every string copied into its own `std::string`. That is the right trade-off when the program
|
||||
goes on to read and write the value freely, but it does more work than necessary when only a small part of a large
|
||||
JSON text is actually needed, or when the same text is parsed over and over (many small messages, for instance) and
|
||||
most of the resulting tree is thrown away almost immediately.
|
||||
|
||||
## The idea
|
||||
|
||||
[`basic_json_document::parse()`](../../api/basic_json_document/parse.md) parses the same JSON grammar, with the same
|
||||
options, but instead of a tree it builds a flat index of the values it found: one
|
||||
[16-byte entry](../../home/architecture.md#node-index-of-json-views) per value (and one per object key), in document
|
||||
order. Integers are converted while parsing and stored in their entry. Floating-point numbers and strings are
|
||||
referenced in place in the source text: a float is converted when it is read, and only strings that contain escape
|
||||
sequences are decoded, into one shared buffer owned by the document.
|
||||
|
||||
[`basic_json_view`](../../api/basic_json_view/index.md) is a small, trivially copyable handle (two pointers) into that
|
||||
index. It gives you the read-only, type-inspection part of the `basic_json` interface —
|
||||
[`type()`](../../api/basic_json_view/type.md) and the `is_*()` predicates,
|
||||
[`size()`](../../api/basic_json_view/size.md)/[`empty()`](../../api/basic_json_view/empty.md) — as well as element
|
||||
access ([`operator[]`](../../api/basic_json_view/operator%5B%5D.md), [`at`](../../api/basic_json_view/at.md),
|
||||
[`front`](../../api/basic_json_view/front.md)/[`back`](../../api/basic_json_view/back.md)), lookup
|
||||
([`find`](../../api/basic_json_view/find.md), [`contains`](../../api/basic_json_view/contains.md),
|
||||
[`count`](../../api/basic_json_view/count.md)), and iteration
|
||||
([`begin`](../../api/basic_json_view/begin.md)/[`end`](../../api/basic_json_view/end.md),
|
||||
[`items`](../../api/basic_json_view/items.md)) — without ever allocating a `basic_json` value. When you do need an
|
||||
actual `basic_json` value for a subtree, [`materialize()`](../../api/basic_json_view/materialize.md) builds exactly the
|
||||
one [`parse()`](../../api/basic_json/parse.md) would have produced for it.
|
||||
|
||||
The same small text, parsed both ways:
|
||||
|
||||
<div class="nj-fig-wrap" markdown>
|
||||
--8<-- "images/json_view_layout.svg"
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>Top: the tree of separate heap allocations that `basic_json::parse()` builds. Bottom: `json_document::parse()` keeps the source text and builds one flat index of 16-byte nodes that point back into it, plus a buffer of decoded strings.</p>
|
||||
|
||||
## How to use it
|
||||
|
||||
Include `<nlohmann/json_view.hpp>` in addition to (or instead of) `<nlohmann/json.hpp>`. Parse into a
|
||||
[`json_document`](../../api/json_document.md), inspect its [`root()`](../../api/basic_json_document/root.md), and
|
||||
`materialize()` when you need a real value. `materialize()` works on any view, not just the root, so you can turn just
|
||||
the subtree you need into a value:
|
||||
|
||||
??? example "Example: parse a document, inspect its root, and materialize it"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_document.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_document.output"
|
||||
```
|
||||
|
||||
[`ordered_json_document`](../../api/ordered_json_document.md) is the equivalent for
|
||||
[`ordered_json`](../../api/ordered_json.md), just as [`ordered_json`](../../api/ordered_json.md) is to
|
||||
[`json`](../../api/json.md).
|
||||
|
||||
A view behaves like a `basic_json` value in most respects, but not in all: lookups of a repeated key, the order in
|
||||
which an object's members are visited, and what a missing key does to chained `operator[]` are the most visible
|
||||
differences. [Differences from `basic_json`](differences.md) lists all of them.
|
||||
|
||||
## Where to go next
|
||||
|
||||
- [Ownership and lifetime](lifetime.md) - when a document borrows its source text, and how long a view stays valid
|
||||
- [Differences from `basic_json`](differences.md) - everything a view does differently from a parsed `basic_json` value
|
||||
- [Reading values](reading.md) - converting with `get<T>()`, reading strings and numbers without copying, and writing a
|
||||
view back with `dump()`
|
||||
- [Writing generic code](generic_code.md) - functions and `from_json()` overloads that accept views
|
||||
- [Editing a document](editing.md) - patching a document in place, keeping its member order and number spellings
|
||||
- [Images](images.md) - saving a parsed document and loading it back without parsing
|
||||
|
||||
## Choosing between `json`, `ordered_json`, the SAX interface, and `json_view`
|
||||
|
||||
| | [`json`](../../api/json.md) / [`ordered_json`](../../api/ordered_json.md) | [SAX interface](../parsing/sax_interface.md) | [`json_document`](../../api/json_document.md) / [`json_view`](../../api/json_view.md) | [`json_editable_document`](../../api/json_editable_document.md) / [`json_editable_view`](../../api/json_editable_view.md) |
|
||||
|---|---|---|---|---|
|
||||
| **Ownership** | owns every value | owns nothing; you decide what to keep, in your handler | borrows or owns the *text*; the index is always owned by the document | same as `json_document`; edits go to storage the document owns |
|
||||
| **Mutability** | freely mutable | not applicable (a one-shot event stream) | read-only | [`set`](../../api/basic_json_document/set.md)/[`push_back`](../../api/basic_json_document/push_back.md)/[`insert`](../../api/basic_json_document/insert.md)/[`erase`](../../api/basic_json_document/erase.md) edit in place; the source text is never rewritten |
|
||||
| **What you get** | a full tree you can read, write, and keep as long as you like | a sequence of callbacks; whatever your handler builds from them | a flat index plus, on demand, [`materialize()`](../../api/basic_json_view/materialize.md)d `json`/`ordered_json` values for the parts you actually use | the same, plus [`dump()`](../../api/basic_json_view/dump.md) of an edited document that keeps the member order and, with [`number_format::source`](../../api/basic_json_view/number_format.md), the spelling of every untouched number |
|
||||
| **Typical use** | general-purpose JSON handling: config, request/response bodies you build or modify, anything you hold onto | validating or projecting a text into your own data structure without ever holding the whole thing as JSON | large or high-volume input where you only need part of it, or need it repeatedly, and can keep the source text (or a copy) alive for as long as the document lives | a document you read, patch a few fields of, and write back — a configuration file, for instance — where the rest of it should come back exactly as it was |
|
||||
| **Caching/reload** | not applicable — re-parse, or roll your own serialization | not applicable | [`save()`](../../api/basic_json_document/save.md)/[`load()`](../../api/basic_json_document/load.md): cache the parsed index as an [image](images.md) and reload it without parsing | same, saving the document's current — possibly edited — state |
|
||||
|
||||
<p class="nj-table-caption" markdown>Each column is one way to work with JSON in this library, and each row compares one property of them.</p>
|
||||
|
||||
## See also
|
||||
|
||||
- [`basic_json_document`](../../api/basic_json_document/index.md) - the document that owns the parsed index (parse, access, images, edits)
|
||||
- [`basic_json_view`](../../api/basic_json_view/index.md) - the non-owning handle to a value in a document
|
||||
- [`json_document`](../../api/json_document.md) - and [`ordered_json_document`](../../api/ordered_json_document.md) - the read-only documents
|
||||
- [`json_editable_document`](../../api/json_editable_document.md) - and [`ordered_json_editable_document`](../../api/ordered_json_editable_document.md) - the documents that can be edited in place
|
||||
- [Architecture](../../home/architecture.md#node-index-of-json-views) - the layout of the node index
|
||||
- [SAX interface](../parsing/sax_interface.md) - event-based parsing without building a tree
|
||||
- [Performance](../performance.md) - benchmarks and tuning of parsing and serialization
|
||||
- [Large, Streamed, and Partial Input](../parsing/large_and_partial_input.md) - reading only the part of a text you need
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,73 @@
|
||||
# Ownership and lifetime
|
||||
|
||||
A document either **borrows** the text it was parsed from, or **owns** its own copy of it; call
|
||||
[`owns_source()`](../../api/basic_json_document/owns_source.md) to find out which happened.
|
||||
[`parse()`](../../api/basic_json_document/parse.md) decides this from the value category and type of its argument (an
|
||||
lvalue `#!cpp std::string` is borrowed; an rvalue `#!cpp std::string` is moved in, owned without a copy; a stream is
|
||||
read into an owned buffer; and so on — see [`parse`'s Notes](../../api/basic_json_document/parse.md#notes) for the
|
||||
full table). [`parse_copy()`](../../api/basic_json_document/parse_copy.md) always owns a copy, regardless of the input.
|
||||
|
||||
!!! warning "A borrowed document depends on your buffer"
|
||||
|
||||
If a document borrows its text, that text **must outlive the document** (and every view taken from it) and must
|
||||
stay **unmodified** for as long as the document exists, since floating-point values and unescaped strings are
|
||||
read from it lazily. Reading or writing through a view after the underlying buffer is gone is undefined behavior,
|
||||
exactly as it would be for a dangling `#!cpp std::string_view`.
|
||||
|
||||
## When a view is valid
|
||||
|
||||
A view is valid only while all of the following hold:
|
||||
|
||||
- the document is alive,
|
||||
- the document has not been re-parsed since the view was taken (with
|
||||
[`read()`](../../api/basic_json_document/read.md) or [`parse()`](../../api/basic_json_document/parse.md) into it),
|
||||
- the document has not had [`shrink_to_fit()`](../../api/basic_json_document/shrink_to_fit.md) called on it since, and
|
||||
- if the document borrows its source text, that text is still alive and unmodified.
|
||||
|
||||
Moving the `basic_json_document<>` itself is fine and does **not** invalidate its views: the index is a separate heap
|
||||
allocation that keeps its address across the move. Take a fresh view from
|
||||
[`root()`](../../api/basic_json_document/root.md) whenever any of the other conditions above was not met. Edits of an
|
||||
[editable document](editing.md) keep views valid, too; see [What stays valid](editing.md#what-stays-valid-and-what-an-edit-costs).
|
||||
|
||||
<div class="nj-fig-wrap" markdown>
|
||||
--8<-- "images/json_view_lifetime.svg"
|
||||
</div>
|
||||
|
||||
<p class="nj-caption" markdown>Four timelines of a document and its views, each bar showing when an object is alive or valid and when it dangles. Destroying the borrowed text, re-parsing, or shrinking the document invalidates the views taken before; moving the document does not.</p>
|
||||
|
||||
## Why views can dangle
|
||||
|
||||
A view can dangle, exactly like a `#!cpp std::string_view`: nothing stops you from using it after its document is
|
||||
gone. This is deliberate. A view is two pointers and trivially copyable; making it safe (a `#!cpp std::shared_ptr` in
|
||||
the document and a `#!cpp std::weak_ptr` in each view) would make it larger, add reference counting to every copy,
|
||||
and a `lock()` to every access — exactly the costs the view exists to avoid. What is caught is the obvious case:
|
||||
because a view dies with its document, [`root()`](../../api/basic_json_document/root.md) is not callable on a
|
||||
temporary document: `#!cpp auto v = json_document::parse(text).root();` does not compile. Give the document a name
|
||||
first.
|
||||
|
||||
The same holds for what a view hands out without copying: a string from
|
||||
[`get_string()`](../../api/basic_json_view/get_string.md), a token from
|
||||
[`number_token()`](../../api/basic_json_view/number_token.md), and [`string_view` members](reading.md#string_view-members)
|
||||
of decoded structs are valid only as long as the document and, if it borrows, its source text.
|
||||
|
||||
??? example "Example: borrowed and owned documents, and when views become invalid"
|
||||
|
||||
```cpp
|
||||
--8<-- "examples/json_view_ownership.cpp"
|
||||
```
|
||||
|
||||
Output:
|
||||
|
||||
```json
|
||||
--8<-- "examples/json_view_ownership.output"
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`basic_json_document`](../../api/basic_json_document/index.md) - the document that owns the parsed index
|
||||
- [`owns_source()`](../../api/basic_json_document/owns_source.md) - whether a document borrows its source text
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -0,0 +1,83 @@
|
||||
# Reading values
|
||||
|
||||
## Getting values out without copying
|
||||
|
||||
[`get<T>()`](../../api/basic_json_view/get.md) converts most `T` directly from the flat index, without ever building a
|
||||
`basic_json` value for the conversion: `#!cpp bool`, arithmetic types, `#!cpp std::nullptr_t`,
|
||||
`#!cpp std::string`/other `#!cpp std::basic_string`s (copied once), `basic_json_view` itself, the standard containers
|
||||
and other types the library converts (`#!cpp std::vector`, `#!cpp std::map`, `#!cpp std::list`, `#!cpp std::array`,
|
||||
`#!cpp std::pair`, `#!cpp std::tuple`, `#!cpp std::optional`, ...), and the types of the `NLOHMANN_DEFINE_TYPE_*` and
|
||||
`NLOHMANN_JSON_SERIALIZE_ENUM` macros. Types whose `from_json()` is written for `basic_json` only go through
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md)`.get<T>()` instead: the subtree is built into a real
|
||||
`basic_json` value first, exactly as [`parse()`](../../api/basic_json/parse.md) would, and converted from there. See
|
||||
[A `from_json()` that reads views](generic_code.md#a-from_json-that-reads-views) for how to write a `from_json()` that
|
||||
reads views, and [Duplicate keys](differences.md#duplicate-keys) for the one case in which the two ways give different
|
||||
results.
|
||||
|
||||
Two conversions never copy at all:
|
||||
|
||||
- [`get_string()`](../../api/basic_json_view/get_string.md) (equivalently, `#!cpp get<string_view_t>()`) returns a
|
||||
string as a `string_view_t` pointing into the document's [`source()`](../../api/basic_json_document/source.md) text
|
||||
— or, for a string that contains escape sequences, into the document's own buffer of decoded strings — instead of
|
||||
allocating a new `#!cpp std::string`.
|
||||
- [`number_token()`](../../api/basic_json_view/number_token.md) returns a number exactly as it was written in the
|
||||
source, e.g. `#!cpp "1.50"`, `#!cpp "1E2"`, or an integer with more digits than any number type holds, instead of
|
||||
rounding it into a `#!cpp double`/`#!cpp int64_t` the way `#!cpp get<T>()` (and
|
||||
[`basic_json::parse()`](../../api/basic_json/parse.md)) would.
|
||||
|
||||
Both results are only valid as long as the document and, if it [borrows its source text](lifetime.md), that text.
|
||||
|
||||
### `string_view` members
|
||||
|
||||
A struct whose member is a `#!cpp std::string_view` (C++17) can be decoded from a view with the
|
||||
`NLOHMANN_DEFINE_TYPE_*` macros, and the member is not copied either: for a string without escape sequences it points
|
||||
into the document's source text, and for a string with escape sequences into the document's buffer of decoded
|
||||
strings. The member is valid as long as the document is alive and, for a document that
|
||||
[borrows its source text](lifetime.md) (as [`parse()`](../../api/basic_json_document/parse.md) does for an lvalue
|
||||
`#!cpp std::string`, a `#!cpp std::string_view`, or a C string), as long as that text is.
|
||||
|
||||
```cpp
|
||||
struct record
|
||||
{
|
||||
std::string_view name;
|
||||
int count;
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(record, name, count)
|
||||
};
|
||||
|
||||
const std::string text = R"({"name": "widget", "count": 3})";
|
||||
const json_document doc = json_document::parse(text); // borrows text
|
||||
const record r = doc.root().get<record>(); // r.name points into text, valid while text and doc are
|
||||
```
|
||||
|
||||
!!! warning "Decoding into a `string_view` from a `json` value dangles at once"
|
||||
|
||||
The same struct also compiles with `#!cpp json::parse(text).get<record>()`, but there `name` points into the
|
||||
temporary `json` value, which is destroyed at the end of the statement. Use a named
|
||||
[`json_document`](../../api/json_document.md), as above, to decode such a struct.
|
||||
|
||||
## Writing a view back
|
||||
|
||||
[`dump()`](../../api/basic_json_view/dump.md) serializes a view directly from the flat index, without ever building a
|
||||
`basic_json` value. It writes object members in document order and every occurrence of a repeated key, so it can
|
||||
differ from `#!cpp materialize().dump()`; see [Serialization](differences.md#serialization).
|
||||
|
||||
By default, numbers are written the way [`basic_json::dump()`](../../api/basic_json/dump.md) would.
|
||||
[`number_format::source`](../../api/basic_json_view/number_format.md) instead copies every number exactly as it was
|
||||
written in the source text — a price like `#!cpp 19.90`, a long order or account ID with more digits than any number
|
||||
type holds, or a high-precision coordinate — something `basic_json` cannot do at all, since parsing already reduces
|
||||
a number to its parsed `#!cpp double`/`#!cpp int64_t` value. Together with an [editable document](editing.md), this
|
||||
lets you patch a file without reformatting the rest of it.
|
||||
|
||||
[`operator<<`](../../api/basic_json_view/operator_ltlt.md) writes a view to a stream the way `basic_json`'s does, using
|
||||
the stream's `width`/`fill` for indentation.
|
||||
|
||||
## See also
|
||||
|
||||
- [Zero-copy JSON views](index.md) - overview
|
||||
- [`get`](../../api/basic_json_view/get.md) - convert a view
|
||||
- [`dump`](../../api/basic_json_view/dump.md) - serialize a view
|
||||
- [Writing generic code](generic_code.md) - functions and `from_json()` overloads that accept views
|
||||
|
||||
## Version history
|
||||
|
||||
- Added in version 3.13.0.
|
||||
@@ -88,7 +88,7 @@ a.erase(1); // [1,3,4] (erase by index)
|
||||
## Editing a document
|
||||
|
||||
The operations above work on a `basic_json` value. A JSON text that was parsed into a
|
||||
[document](json_view.md#editing-a-document) can also be changed in place, without building a `basic_json` tree for the
|
||||
[document](json_view/editing.md) can also be changed in place, without building a `basic_json` tree for the
|
||||
parts that are not touched: [`set`](../api/basic_json_document/set.md) replaces a value, adds or replaces an object
|
||||
member, or replaces an array element (also through a JSON pointer),
|
||||
[`push_back`](../api/basic_json_document/push_back.md) appends to an array,
|
||||
@@ -105,7 +105,7 @@ editable document types, such as [`json_editable_document`](../api/json_editable
|
||||
- [`merge_patch`](../api/basic_json/merge_patch.md) - apply an RFC 7396 merge patch
|
||||
- [`erase`](../api/basic_json/erase.md) - / [`clear`](../api/basic_json/clear.md) - remove elements
|
||||
- [JSON Patch and Diff](json_patch.md) - and [JSON Merge Patch](merge_patch.md) - structured modifications
|
||||
- [Editing a document](json_view.md#editing-a-document) - change a parsed document in place
|
||||
- [Editing a document](json_view/editing.md) - change a parsed document in place
|
||||
- [`insert`](../api/basic_json/insert.md) - insert elements at an iterator position or merge a range
|
||||
- [`operator+=`](../api/basic_json/operator+=.md) - shorthand for `push_back`
|
||||
- [Element Access](element_access/index.md) - read elements
|
||||
|
||||
@@ -94,7 +94,7 @@ ahead: after parsing, it is positioned exactly as if every character had been re
|
||||
[`operator>>`](../../api/operator_gtgt.md) can still read several values from one stream (see also
|
||||
[JSON Lines](json_lines.md)).
|
||||
|
||||
This does not hold for [`json_document`](../json_view.md): it reads a stream into a buffer it owns, so the stream saves
|
||||
This does not hold for [`json_document`](../json_view/index.md): it reads a stream into a buffer it owns, so the stream saves
|
||||
no memory, and reading the file into a `#!cpp std::string` yourself and borrowing it is about 6 to 12 % faster.
|
||||
|
||||
Two macros switch these optimizations off without changing any result:
|
||||
@@ -123,7 +123,7 @@ The library offers two parsing models, and a third, read-only alternative:
|
||||
reads the same JSON grammar but builds a flat, read-only index of the values instead of a `basic_json` tree. Strings and
|
||||
floating-point numbers are read from the text on demand, and only the parts you
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) become `basic_json` values. This avoids most of the work when you
|
||||
need only a few values from a large or frequently parsed text; see [Zero-copy JSON views](../json_view.md). It is read-only, so use
|
||||
need only a few values from a large or frequently parsed text; see [Zero-copy JSON views](../json_view/index.md). It is read-only, so use
|
||||
`parse` when you need to modify the value.
|
||||
|
||||
You can influence a DOM parse without switching to the SAX interface by passing a
|
||||
@@ -147,7 +147,7 @@ json_document doc = json_document::parse(R"({"happy": true, "pi": 3.141})");
|
||||
std::cout << doc.root()["happy"].get<bool>() << '\n';
|
||||
```
|
||||
|
||||
See [Zero-copy JSON views](../json_view.md) for the concept and the trade-offs.
|
||||
See [Zero-copy JSON views](../json_view/index.md) for the concept and the trade-offs.
|
||||
|
||||
## Exceptions
|
||||
|
||||
@@ -166,7 +166,7 @@ options.
|
||||
- [Large, streamed, and partial input](large_and_partial_input.md) - chunked, concatenated, and very large input
|
||||
- [parser callbacks](parser_callbacks.md) - influence the parsing by a callback function
|
||||
- [SAX interface](sax_interface.md) - implement a custom SAX handler
|
||||
- [Zero-copy JSON views](../json_view.md) - parse into a read-only document and read it through views
|
||||
- [Zero-copy JSON views](../json_view/index.md) - parse into a read-only document and read it through views
|
||||
- [parsing and exceptions](parse_exceptions.md) - control error handling
|
||||
- [parsing untrusted input](untrusted_input.md) - what to consider when parsing input from untrusted sources
|
||||
- [`operator>>`](../../api/operator_gtgt.md) - deserialize from stream
|
||||
|
||||
@@ -156,11 +156,11 @@ record the reason in the handler (here: `id`) if you need to tell the two apart.
|
||||
|
||||
### Read parts of a large document with a view
|
||||
|
||||
If the whole text is available and you only need to read some of it, a [`json_document`](../json_view.md) from
|
||||
If the whole text is available and you only need to read some of it, a [`json_document`](../json_view/index.md) from
|
||||
`<nlohmann/json_view.hpp>` (added in version 3.13.0) avoids the `basic_json` tree altogether: it keeps the text, builds a flat index of the values,
|
||||
and gives read-only [views](../../api/basic_json_view/index.md) of the parts you look at. Only what you
|
||||
[`materialize()`](../../api/basic_json_view/materialize.md) becomes a `basic_json` value. See
|
||||
[Zero-copy JSON views](../json_view.md) for details and for the lifetime rules.
|
||||
[Zero-copy JSON views](../json_view/index.md) for details and for the lifetime rules.
|
||||
|
||||
## See also
|
||||
|
||||
@@ -168,7 +168,7 @@ and gives read-only [views](../../api/basic_json_view/index.md) of the parts you
|
||||
- [JSON Lines](json_lines.md) - newline-delimited JSON
|
||||
- [Parser callbacks](parser_callbacks.md) - discard values while parsing
|
||||
- [SAX interface](sax_interface.md) - event-based parsing
|
||||
- [Zero-copy JSON views](../json_view.md) - read parts of a large document without building a tree
|
||||
- [Zero-copy JSON views](../json_view/index.md) - read parts of a large document without building a tree
|
||||
- [Untrusted input](untrusted_input.md) - limits for input you do not control
|
||||
- [`operator>>`](../../api/operator_gtgt.md) - deserialize from stream
|
||||
- [`parse`](../../api/basic_json/parse.md) - deserialize from a compatible input
|
||||
|
||||
@@ -40,7 +40,7 @@ optimization but not the second, since the byte-scanning fast path requires cont
|
||||
|
||||
Practically: a file can be passed directly to `parse`, which also avoids the memory for a copy of the file. Reading it
|
||||
into a string first is no longer necessary for speed (this is for `#!cpp json::parse`; a
|
||||
[`json_document`](json_view.md) reads a stream into an owned buffer anyway, so for it reading the file into a string
|
||||
[`json_document`](json_view/index.md) reads a stream into an owned buffer anyway, so for it reading the file into a string
|
||||
and borrowing that is the faster way):
|
||||
|
||||
```cpp
|
||||
@@ -73,12 +73,12 @@ a DOM, three alternatives avoid building it:
|
||||
discard finished elements as soon as they are handled, so memory usage stays bounded by one element (plus the
|
||||
unparsed remainder of the input) instead of the whole document — see the [recipe for streaming a large homogeneous
|
||||
array](parsing/parser_callbacks.md#recipe-streaming-a-large-homogeneous-array).
|
||||
- Parse into a [`json_document`](json_view.md) (`#!cpp <nlohmann/json_view.hpp>`) instead of a `basic_json`. It keeps
|
||||
- Parse into a [`json_document`](json_view/index.md) (`#!cpp <nlohmann/json_view.hpp>`) instead of a `basic_json`. It keeps
|
||||
the input text and builds a flat index of 16 bytes per value; strings and floating-point numbers are not copied, but
|
||||
read from the text when needed. Read-only [views](../api/basic_json_view/index.md) give the familiar element access, and only the
|
||||
parts you [`materialize()`](../api/basic_json_view/materialize.md) become `basic_json` values. A document that
|
||||
borrows the text instead of owning a copy needs the text to outlive it; see
|
||||
[choosing between `json`, the SAX interface, and `json_view`](json_view.md#choosing-between-json-ordered_json-the-sax-interface-and-json_view).
|
||||
[choosing between `json`, the SAX interface, and `json_view`](json_view/index.md#choosing-between-json-ordered_json-the-sax-interface-and-json_view).
|
||||
|
||||
If the data is naturally record-oriented, consider [JSON Lines](parsing/json_lines.md) instead of one large JSON
|
||||
document: reading and parsing it line by line with `#!cpp std::getline` means only one line's value is ever in memory
|
||||
@@ -182,11 +182,11 @@ an adapter, since their template argument order does not match what `basic_json`
|
||||
large value therefore doubles its memory; see [Avoiding copies](#avoiding-copies). `#!cpp auto x = j["key"];` is a
|
||||
copy, `#!cpp auto& x = j["key"];` is not.
|
||||
- **A moved-from value is `null`.** After `#!cpp json c = std::move(a);` the value `a` is `#!json null` and owns nothing.
|
||||
- **Reading does not require a tree.** If you only read the data, parse it into a [`json_document`](json_view.md)
|
||||
- **Reading does not require a tree.** If you only read the data, parse it into a [`json_document`](json_view/index.md)
|
||||
(`#!cpp <nlohmann/json_view.hpp>`, added in version 3.13.0) instead of a `basic_json`. It stores 16 bytes per value, does not copy floating-point
|
||||
numbers or strings without escape sequences out of the text, and creates no `basic_json` value except for the parts
|
||||
you [`materialize()`](../api/basic_json_view/materialize.md). A document that borrows the text needs the text to
|
||||
outlive it; see [Zero-copy JSON views](json_view.md).
|
||||
outlive it; see [Zero-copy JSON views](json_view/index.md).
|
||||
- **Containers keep their capacity.** `clear()` and `erase()` on an array remove the elements, but the underlying
|
||||
`#!cpp std::vector` keeps its allocated capacity, like `#!cpp std::vector::clear` does. To give the memory back,
|
||||
assign a new value (`#!cpp j = json::array();`) or destroy the value.
|
||||
@@ -267,7 +267,7 @@ those headers are then never processed by the compiler at all.
|
||||
- [Architecture](../home/architecture.md) - how input adapters, the lexer, and the serializer fit together
|
||||
- [Parsing](parsing/index.md) - the available parsing functions and inputs
|
||||
- [SAX interface](parsing/sax_interface.md) - parse without building a DOM
|
||||
- [Zero-copy JSON views](json_view.md) - parse into a flat index of the text and read it without building a DOM
|
||||
- [Zero-copy JSON views](json_view/index.md) - parse into a flat index of the text and read it without building a DOM
|
||||
- [Binary formats](binary_formats/index.md) - compact alternatives to JSON text
|
||||
- [Object Order](object_order.md) - `json` vs. `ordered_json` and other `ObjectType` choices
|
||||
- [Template Parameter Requirements](types/template_parameters.md) - custom container and allocator types
|
||||
|
||||
@@ -56,7 +56,7 @@ The public headers are in [`include/nlohmann`](https://github.com/nlohmann/json/
|
||||
- [`json_view.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/json_view.hpp) is a separate,
|
||||
optional header that defines [`basic_json_document`](../api/basic_json_document/index.md) and
|
||||
[`basic_json_view`](../api/basic_json_view/index.md), a flat-index, read-only, non-owning way to look at a parsed
|
||||
JSON text; see [Zero-copy JSON views](../features/json_view.md). It builds on `json.hpp` internals (it requires the
|
||||
JSON text; see [Zero-copy JSON views](../features/json_view/index.md). It builds on `json.hpp` internals (it requires the
|
||||
same library version) and has its own `detail/view/` subdirectory.
|
||||
|
||||
Everything else lives in [`detail/`](https://github.com/nlohmann/json/tree/develop/include/nlohmann/detail) and namespace `nlohmann::detail`, which is not part of the public API. Paths
|
||||
@@ -175,7 +175,7 @@ maintains the invariant that the pointer matching `m_type` is never null; `asser
|
||||
|
||||
## Node index of JSON views
|
||||
|
||||
A [`basic_json_document`](../api/basic_json_document/index.md) (see [Zero-copy JSON views](../features/json_view.md))
|
||||
A [`basic_json_document`](../api/basic_json_document/index.md) (see [Zero-copy JSON views](../features/json_view/index.md))
|
||||
does not build a tree of values. Its parser
|
||||
([`detail/view/builder.hpp`](https://github.com/nlohmann/json/blob/develop/include/nlohmann/detail/view/builder.hpp))
|
||||
writes a flat array of 16-byte nodes, one per value and one per object key, in document order. A
|
||||
@@ -466,7 +466,7 @@ release. Besides the components above, it contains:
|
||||
- [`adl_serializer`](../api/adl_serializer/index.md) - customization point for type conversions
|
||||
- [`json_sax`](../api/json_sax/index.md) - interface of the SAX parser events
|
||||
- [SAX Interface](../features/parsing/sax_interface.md) - how to consume parser events without building a DOM
|
||||
- [Zero-copy JSON views](../features/json_view.md) - the flat node index that backs views and documents
|
||||
- [Zero-copy JSON views](../features/json_view/index.md) - the flat node index that backs views and documents
|
||||
- [Template Parameter Requirements](../features/types/template_parameters.md) - the template parameters of basic_json
|
||||
- [Serialization](../features/serialization.md) - the output side of the library
|
||||
- [`nlohmann` Namespace](../features/namespace.md) - how the library namespace is structured
|
||||
@@ -438,7 +438,7 @@ A UBJSON or BJData high-precision number could not be parsed.
|
||||
### json.exception.parse_error.116
|
||||
|
||||
[`basic_json_document::load()`](../api/basic_json_document/load.md) rejected an
|
||||
[image](../features/json_view.md#images): either the bytes are not one [`save()`](../api/basic_json_document/save.md)
|
||||
[image](../features/json_view/images.md): either the bytes are not one [`save()`](../api/basic_json_document/save.md)
|
||||
could have written (too short, an unknown magic number or format version, or sizes that do not fit the buffer), or
|
||||
they are, but fail the requested [`image_check`](../api/basic_json_document/load.md#image_check).
|
||||
|
||||
@@ -450,7 +450,7 @@ they are, but fail the requested [`image_check`](../api/basic_json_document/load
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view.md#images).
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view/images.md).
|
||||
|
||||
## Iterator errors
|
||||
|
||||
@@ -889,12 +889,12 @@ from JSON text.
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with editable [`json_document`s](../features/json_view.md).
|
||||
This exception was added in version 3.13.0, together with editable [`json_document`s](../features/json_view/editing.md).
|
||||
|
||||
### json.exception.type_error.320
|
||||
|
||||
[`basic_json_document::save()`](../api/basic_json_document/save.md) cannot write an
|
||||
[image](../features/json_view.md#images) of a [discarded](../api/basic_json_document/is_discarded.md) document.
|
||||
[image](../features/json_view/images.md) of a [discarded](../api/basic_json_document/is_discarded.md) document.
|
||||
|
||||
!!! failure "Example messages"
|
||||
|
||||
@@ -904,7 +904,7 @@ from JSON text.
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view.md#images).
|
||||
This exception was added in version 3.13.0, together with [images](../features/json_view/images.md).
|
||||
|
||||
### json.exception.type_error.321
|
||||
|
||||
@@ -1192,7 +1192,7 @@ so they do not support an input of 4294967280 bytes (4 GiB minus 16 bytes) or mo
|
||||
storage: [`set`](../api/basic_json_document/set.md) and [`push_back`](../api/basic_json_document/push_back.md) throw
|
||||
this exception once the strings and number tokens written by edits reach 4 GiB in total, or once more than
|
||||
4294967295 arrays/objects have had an element set or appended to them. The same limit applies to an
|
||||
[image](../features/json_view.md#images): [`save()`](../api/basic_json_document/save.md) throws it if the node
|
||||
[image](../features/json_view/images.md): [`save()`](../api/basic_json_document/save.md) throws it if the node
|
||||
count, the text, or the decoded strings it would write would individually reach 4 GiB.
|
||||
|
||||
!!! failure "Example messages"
|
||||
@@ -1209,7 +1209,7 @@ count, the text, or the decoded strings it would write would individually reach
|
||||
|
||||
!!! note
|
||||
|
||||
This exception was added in version 3.13.0, together with [`<nlohmann/json_view.hpp>`](../features/json_view.md).
|
||||
This exception was added in version 3.13.0, together with [`<nlohmann/json_view.hpp>`](../features/json_view/index.md).
|
||||
[`basic_json::parse()`](../api/basic_json/parse.md) has no such limit.
|
||||
|
||||
## Further exceptions
|
||||
|
||||
@@ -140,7 +140,7 @@ Read newline-delimited input line by line ([JSON Lines](../features/parsing/json
|
||||
|
||||
Handle and discard the records of a large array with a [parser callback](../features/parsing/parser_callbacks.md), stop
|
||||
early with the [SAX interface](../features/parsing/sax_interface.md), or read parts of the text through a
|
||||
[`json_document`](../features/json_view.md) (added in version 3.13.0). See
|
||||
[`json_document`](../features/json_view/index.md) (added in version 3.13.0). See
|
||||
[Input too large for memory](../features/parsing/large_and_partial_input.md#input-too-large-for-memory).
|
||||
|
||||
### Position of a parse error
|
||||
|
||||
@@ -17,16 +17,16 @@
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M76 115 L106 115" marker-end="url(#jvl-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="108" y="98" width="84" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono" x="150" y="120" text-anchor="middle" xml:space="preserve">std::map</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 C192 115 226 67 226 67" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 67" marker-end="url(#jvl-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="50" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="72" xml:space="preserve">"port"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-num" x="396" y="72" text-anchor="end" xml:space="preserve">6379</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 C192 115 226 115 226 115" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 115" marker-end="url(#jvl-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="98" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="120" xml:space="preserve">"price"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-num" x="396" y="120" text-anchor="end" xml:space="preserve">19.9</text>
|
||||
<text class="nj-jsonview-note" x="418" y="120" xml:space="preserve">double: 19.90 is gone</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 C192 115 226 163 226 163" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 163" marker-end="url(#jvl-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="146" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="168" xml:space="preserve">"tags"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-line" x="396" y="168" text-anchor="end" xml:space="preserve">•</text>
|
||||
@@ -38,8 +38,8 @@
|
||||
<path class="nj-jsonview-sep" d="M624 146 V180"/>
|
||||
<text class="nj-jsonview-mono" x="601" y="168" text-anchor="middle" xml:space="preserve">json</text>
|
||||
<text class="nj-jsonview-mono" x="647" y="168" text-anchor="middle" xml:space="preserve">json</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M601 146 C601 126 706 150 706 130" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M647 180 C647 200 706 176 706 196" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M601 146 C601 130 641 130 706 130" marker-end="url(#jvl-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M647 180 C647 196 687 196 706 196" marker-end="url(#jvl-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="708" y="113" width="126" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-sm nj-jsonview-c-str" x="771" y="135" text-anchor="middle" xml:space="preserve">std::string eu</text>
|
||||
<rect class="nj-jsonview-heap" x="708" y="179" width="126" height="34" rx="5"/>
|
||||
|
||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
@@ -0,0 +1,148 @@
|
||||
<svg class="nj-fig nj-jsonview " viewBox="0 0 840 456" role="img" aria-labelledby="fig-jvli-title fig-jvli-title-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="fig-jvli-title">The same J​SON text parsed by json_document::parse()</title>
|
||||
<desc id="fig-jvli-title-d">The same text parsed by json_document::parse(): it keeps the 54 bytes of source text and builds a flat index of nine 16-byte nodes in document order: object, key port, unsigned integer 6379 (the converted value is in the node), key price, float, key tags, array, string eu, and an escaped string. Keys, the float, and the plain string point back into the source text; the escaped string points into the document's buffer of decoded strings. A json_view is two pointers: one to the document and one to a node, here the array.</desc>
|
||||
<defs>
|
||||
<marker id="jvli-line" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-line nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-str" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-str nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-key" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-key nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-num" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-num nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-dec" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-dec nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-own" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-own nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-struct" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-struct nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvli-bad" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-bad nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
</defs>
|
||||
<g transform="translate(0 -236)">
|
||||
<text class="nj-jsonview-h" x="16" y="262" xml:space="preserve">json_document::parse(): the source text stays where it is; one flat index of 16-byte nodes</text>
|
||||
<text class="nj-jsonview-note" x="16" y="290" xml:space="preserve">source text, 54 bytes (borrowed, or owned by the document)</text>
|
||||
<rect class="nj-jsonview-ribbon" x="42" y="300" width="756" height="26" rx="4"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-key" x="71" y="302" width="54" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-num" x="169" y="302" width="54" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-key" x="267" y="302" width="68" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-num" x="379" y="302" width="68" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-key" x="491" y="302" width="54" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-str" x="617" y="302" width="26" height="22" rx="3"/>
|
||||
<rect class="nj-jsonview-span nj-jsonview-c-dec" x="701" y="302" width="54" height="22" rx="3"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="49" y="317.5" text-anchor="middle" xml:space="preserve">{</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="63" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="77" y="317.5" text-anchor="middle" xml:space="preserve">p</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="91" y="317.5" text-anchor="middle" xml:space="preserve">o</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="105" y="317.5" text-anchor="middle" xml:space="preserve">r</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="119" y="317.5" text-anchor="middle" xml:space="preserve">t</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="133" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="147" y="317.5" text-anchor="middle" xml:space="preserve">:</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="175" y="317.5" text-anchor="middle" xml:space="preserve">6</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="189" y="317.5" text-anchor="middle" xml:space="preserve">3</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="203" y="317.5" text-anchor="middle" xml:space="preserve">7</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="217" y="317.5" text-anchor="middle" xml:space="preserve">9</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="231" y="317.5" text-anchor="middle" xml:space="preserve">,</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="259" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="273" y="317.5" text-anchor="middle" xml:space="preserve">p</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="287" y="317.5" text-anchor="middle" xml:space="preserve">r</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="301" y="317.5" text-anchor="middle" xml:space="preserve">i</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="315" y="317.5" text-anchor="middle" xml:space="preserve">c</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="329" y="317.5" text-anchor="middle" xml:space="preserve">e</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="343" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="357" y="317.5" text-anchor="middle" xml:space="preserve">:</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="385" y="317.5" text-anchor="middle" xml:space="preserve">1</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="399" y="317.5" text-anchor="middle" xml:space="preserve">9</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="413" y="317.5" text-anchor="middle" xml:space="preserve">.</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="427" y="317.5" text-anchor="middle" xml:space="preserve">9</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="441" y="317.5" text-anchor="middle" xml:space="preserve">0</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="455" y="317.5" text-anchor="middle" xml:space="preserve">,</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="483" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="497" y="317.5" text-anchor="middle" xml:space="preserve">t</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="511" y="317.5" text-anchor="middle" xml:space="preserve">a</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="525" y="317.5" text-anchor="middle" xml:space="preserve">g</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="539" y="317.5" text-anchor="middle" xml:space="preserve">s</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="553" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="567" y="317.5" text-anchor="middle" xml:space="preserve">:</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="595" y="317.5" text-anchor="middle" xml:space="preserve">[</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="609" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="623" y="317.5" text-anchor="middle" xml:space="preserve">e</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="637" y="317.5" text-anchor="middle" xml:space="preserve">u</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="651" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="665" y="317.5" text-anchor="middle" xml:space="preserve">,</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="693" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="707" y="317.5" text-anchor="middle" xml:space="preserve">a</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="721" y="317.5" text-anchor="middle" xml:space="preserve">\</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="735" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="749" y="317.5" text-anchor="middle" xml:space="preserve">b</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="763" y="317.5" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="777" y="317.5" text-anchor="middle" xml:space="preserve">]</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-byte" x="791" y="317.5" text-anchor="middle" xml:space="preserve">}</text>
|
||||
<text class="nj-jsonview-tiny" x="49" y="340" text-anchor="middle" xml:space="preserve">0</text>
|
||||
<text class="nj-jsonview-tiny" x="189" y="340" text-anchor="middle" xml:space="preserve">10</text>
|
||||
<text class="nj-jsonview-tiny" x="329" y="340" text-anchor="middle" xml:space="preserve">20</text>
|
||||
<text class="nj-jsonview-tiny" x="469" y="340" text-anchor="middle" xml:space="preserve">30</text>
|
||||
<text class="nj-jsonview-tiny" x="609" y="340" text-anchor="middle" xml:space="preserve">40</text>
|
||||
<text class="nj-jsonview-tiny" x="749" y="340" text-anchor="middle" xml:space="preserve">50</text>
|
||||
<rect class="nj-jsonview-frame" x="16" y="366" width="808" height="254" rx="10"/>
|
||||
<text class="nj-jsonview-note nj-jsonview-strong" x="30" y="602" xml:space="preserve">json_document: owns the node index and the buffer of decoded strings</text>
|
||||
<text class="nj-jsonview-note" x="30" y="500" xml:space="preserve">node index: 9 nodes × 16 bytes = 144 bytes, in document order</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-struct" x="36" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="42" y="420" xml:space="preserve">0</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-struct" x="78" y="434" text-anchor="middle" xml:space="preserve">object</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="78" y="451" text-anchor="middle" xml:space="preserve">len 3</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="78" y="465" text-anchor="middle" xml:space="preserve">next 9</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-key" x="124" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="130" y="420" xml:space="preserve">1</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-key" x="166" y="434" text-anchor="middle" xml:space="preserve">key</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="166" y="451" text-anchor="middle" xml:space="preserve">off 2</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="166" y="465" text-anchor="middle" xml:space="preserve">len 4</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-key" d="M166 406 C166 367 98 367 98 328" marker-end="url(#jvli-key)"/>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-num" x="212" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="218" y="420" xml:space="preserve">2</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-num" x="254" y="434" text-anchor="middle" xml:space="preserve">uint</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="254" y="451" text-anchor="middle" xml:space="preserve">6379</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="254" y="465" text-anchor="middle" xml:space="preserve">(converted)</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-key" x="300" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="306" y="420" xml:space="preserve">3</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-key" x="342" y="434" text-anchor="middle" xml:space="preserve">key</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="342" y="451" text-anchor="middle" xml:space="preserve">off 16</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="342" y="465" text-anchor="middle" xml:space="preserve">len 5</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-key" d="M342 406 C342 367 301 367 301 328" marker-end="url(#jvli-key)"/>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-num" x="388" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="394" y="420" xml:space="preserve">4</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-num" x="430" y="434" text-anchor="middle" xml:space="preserve">float</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="430" y="451" text-anchor="middle" xml:space="preserve">off 24</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="430" y="465" text-anchor="middle" xml:space="preserve">len 5</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-num" d="M430 406 C430 367 413 367 413 328" marker-end="url(#jvli-num)"/>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-key" x="476" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="482" y="420" xml:space="preserve">5</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-key" x="518" y="434" text-anchor="middle" xml:space="preserve">key</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="518" y="451" text-anchor="middle" xml:space="preserve">off 32</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="518" y="465" text-anchor="middle" xml:space="preserve">len 4</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-key" d="M518 406 C518 367 518 367 518 328" marker-end="url(#jvli-key)"/>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-struct" x="564" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="570" y="420" xml:space="preserve">6</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-struct" x="606" y="434" text-anchor="middle" xml:space="preserve">array</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="606" y="451" text-anchor="middle" xml:space="preserve">len 2</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="606" y="465" text-anchor="middle" xml:space="preserve">next 3</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-str" x="652" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="658" y="420" xml:space="preserve">7</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-str" x="694" y="434" text-anchor="middle" xml:space="preserve">string</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="694" y="451" text-anchor="middle" xml:space="preserve">off 41</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="694" y="465" text-anchor="middle" xml:space="preserve">len 2</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-str" d="M694 406 C694 367 630 367 630 328" marker-end="url(#jvli-str)"/>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-dec" x="740" y="406" width="84" height="68" rx="5"/>
|
||||
<text class="nj-jsonview-tiny" x="746" y="420" xml:space="preserve">8</text>
|
||||
<text class="nj-jsonview-kind nj-jsonview-c-dec" x="782" y="434" text-anchor="middle" xml:space="preserve">string</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="782" y="451" text-anchor="middle" xml:space="preserve">escaped</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-xs" x="782" y="465" text-anchor="middle" xml:space="preserve">len 3</text>
|
||||
<text class="nj-jsonview-note" x="773" y="568" text-anchor="middle" xml:space="preserve">decoded strings</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-dec" x="740" y="518" width="66" height="30" rx="4"/>
|
||||
<text class="nj-jsonview-mono" x="751" y="538" text-anchor="middle" xml:space="preserve">a</text>
|
||||
<text class="nj-jsonview-mono" x="773" y="538" text-anchor="middle" xml:space="preserve">"</text>
|
||||
<text class="nj-jsonview-mono" x="795" y="538" text-anchor="middle" xml:space="preserve">b</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-dec" d="M782 474 C782 496 773 496 773 518" marker-end="url(#jvli-dec)"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-sm" x="470" y="670" text-anchor="end" xml:space="preserve">json_view v = doc.root()["tags"]</text>
|
||||
<rect class="nj-jsonview-node nj-jsonview-c-struct" x="480" y="648" width="140" height="34" rx="6"/>
|
||||
<path class="nj-jsonview-sep" d="M550 648 V682"/>
|
||||
<text class="nj-jsonview-mono" x="515" y="670" text-anchor="middle" xml:space="preserve">doc*</text>
|
||||
<text class="nj-jsonview-mono" x="585" y="670" text-anchor="middle" xml:space="preserve">node*</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-struct" d="M515 648 L515 622" marker-end="url(#jvli-struct)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-struct" d="M585 648 C585 561 606 561 606 474" marker-end="url(#jvli-struct)"/>
|
||||
<text class="nj-jsonview-note" x="30" y="524" xml:space="preserve">integers are converted while parsing and kept in their node;</text>
|
||||
<text class="nj-jsonview-note" x="30" y="542" xml:space="preserve">floats and strings point back into the text</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,49 @@
|
||||
<svg class="nj-fig nj-jsonview " viewBox="0 0 840 222" role="img" aria-labelledby="fig-jvlt-title fig-jvlt-title-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="fig-jvlt-title">A J​SON text parsed by basic_json::parse()</title>
|
||||
<desc id="fig-jvlt-title-d">The text {"port": 6379, "price": 19.90, "tags": ["eu", "a\"b"]} parsed by basic_json::parse(): the root json value points to a std::map whose three nodes are separate heap allocations; the price is stored as the double 19.9; the tags array is a std::vector of two json values, each pointing to its own std::string.</desc>
|
||||
<defs>
|
||||
<marker id="jvlt-line" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-line nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-str" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-str nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-key" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-key nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-num" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-num nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-dec" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-dec nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-own" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-own nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-struct" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-struct nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
<marker id="jvlt-bad" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse"><path class="nj-jsonview-c-bad nj-jsonview-head" d="M0 1 L10 5 L0 9 z"/></marker>
|
||||
</defs>
|
||||
<text class="nj-jsonview-h" x="16" y="26" xml:space="preserve">basic_json::parse(): a tree, every array, object, and string in its own heap allocation</text>
|
||||
<rect class="nj-jsonview-box" x="16" y="98" width="60" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono" x="46" y="120" text-anchor="middle" xml:space="preserve">json</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M76 115 L106 115" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="108" y="98" width="84" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono" x="150" y="120" text-anchor="middle" xml:space="preserve">std::map</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 67" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="50" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="72" xml:space="preserve">"port"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-num" x="396" y="72" text-anchor="end" xml:space="preserve">6379</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 115" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="98" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="120" xml:space="preserve">"price"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-num" x="396" y="120" text-anchor="end" xml:space="preserve">19.9</text>
|
||||
<text class="nj-jsonview-note" x="418" y="120" xml:space="preserve">double: 19.90 is gone</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M192 115 L226 163" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="228" y="146" width="180" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-key" x="240" y="168" xml:space="preserve">"tags"</text>
|
||||
<text class="nj-jsonview-mono nj-jsonview-c-line" x="396" y="168" text-anchor="end" xml:space="preserve">•</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M408 163 L442 163" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="444" y="146" width="104" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono" x="496" y="168" text-anchor="middle" xml:space="preserve">std::vector</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M548 163 L576 163" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="578" y="146" width="92" height="34" rx="5"/>
|
||||
<path class="nj-jsonview-sep" d="M624 146 V180"/>
|
||||
<text class="nj-jsonview-mono" x="601" y="168" text-anchor="middle" xml:space="preserve">json</text>
|
||||
<text class="nj-jsonview-mono" x="647" y="168" text-anchor="middle" xml:space="preserve">json</text>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M601 146 C601 130 641 130 706 130" marker-end="url(#jvlt-line)"/>
|
||||
<path class="nj-jsonview-arr nj-jsonview-c-line" d="M647 180 C647 196 687 196 706 196" marker-end="url(#jvlt-line)"/>
|
||||
<rect class="nj-jsonview-heap" x="708" y="113" width="126" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-sm nj-jsonview-c-str" x="771" y="135" text-anchor="middle" xml:space="preserve">std::string eu</text>
|
||||
<rect class="nj-jsonview-heap" x="708" y="179" width="126" height="34" rx="5"/>
|
||||
<text class="nj-jsonview-mono nj-jsonview-sm nj-jsonview-c-str" x="771" y="201" text-anchor="middle" xml:space="preserve">std::string a"b</text>
|
||||
<rect class="nj-jsonview-heap" x="16" y="186" width="18" height="14" rx="3"/>
|
||||
<text class="nj-jsonview-note" x="42" y="198" xml:space="preserve">a separate heap allocation</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.7 KiB |
@@ -0,0 +1,69 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog" viewBox="0 0 600 380" role="img" aria-labelledby="nj-blog-cliffs nj-blog-cliffs-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-cliffs">Operations that grew quadratically or worse: time with 3.12.0 and 3.13.0, log scale</title>
|
||||
<desc id="nj-blog-cliffs-d">Dot plot on a logarithmic time axis, less is better; an arrow leads from each 3.12.0 time to the 3.13.0 time. diff() 64k numbers vs []: 4237 ms to 10.8 ms; diff() 20k objects vs half: 122 ms to 4.13 ms; parse() callback, 32k objects: 1398 ms to 12.1 ms; operator< nested 24 deep: 64.4 ms to 0.002 ms; operator< citm, 10x: 284 ms to 3.94 ms; flatten() citm, ordered_json: 271 ms to 1.45 ms; to_bson() 200 deep, 100x: 20.3 ms to 0.352 ms; push_back() 100k, diagnostics: 1589 ms to 5.32 ms; at(i) 10k, diagnostics: 45.9 ms to 0.088 ms.</desc>
|
||||
<line class="nj-charts-grid" x1="250" y1="30" x2="250" y2="336"/>
|
||||
<text class="nj-charts-tick" x="250" y="352">1 µs</text>
|
||||
<line class="nj-charts-grid" x1="297.857" y1="30" x2="297.857" y2="336"/>
|
||||
<text class="nj-charts-tick" x="297.857" y="352">10 µs</text>
|
||||
<line class="nj-charts-grid" x1="345.714" y1="30" x2="345.714" y2="336"/>
|
||||
<text class="nj-charts-tick" x="345.714" y="352">0.1 ms</text>
|
||||
<line class="nj-charts-grid" x1="393.571" y1="30" x2="393.571" y2="336"/>
|
||||
<text class="nj-charts-tick" x="393.571" y="352">1 ms</text>
|
||||
<line class="nj-charts-grid" x1="441.429" y1="30" x2="441.429" y2="336"/>
|
||||
<text class="nj-charts-tick" x="441.429" y="352">10 ms</text>
|
||||
<line class="nj-charts-grid" x1="489.286" y1="30" x2="489.286" y2="336"/>
|
||||
<text class="nj-charts-tick" x="489.286" y="352">0.1 s</text>
|
||||
<line class="nj-charts-grid" x1="537.143" y1="30" x2="537.143" y2="336"/>
|
||||
<text class="nj-charts-tick" x="537.143" y="352">1 s</text>
|
||||
<line class="nj-charts-grid" x1="585" y1="30" x2="585" y2="336"/>
|
||||
<text class="nj-charts-tick" x="585" y="352">10 s</text>
|
||||
<text class="nj-charts-tick" x="417.5" y="370">runtime (log scale), less is better</text>
|
||||
<defs><marker id="nj-blog-cliffs-head" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="5" markerHeight="5" orient="auto"><path class="nj-charts-head" d="M0 0 L10 5 L0 10 z"/></marker></defs>
|
||||
<circle class="nj-charts-ojson-dot" cx="250" cy="14" r="5"/><text class="nj-charts-leg" x="260" y="18.5">3.12.0</text>
|
||||
<circle class="nj-charts-json-dot" cx="330" cy="14" r="5"/><text class="nj-charts-leg" x="340" y="18.5">3.13.0</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="52" text-anchor="end">diff() 64k numbers vs []</text>
|
||||
<line class="nj-charts-axis" x1="561.152" y1="48" x2="450.028" y2="48" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="567.152" cy="48" r="5"><title>diff() 64k numbers vs [], 3.12.0: 4237 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="443.028" cy="48" r="5"><title>diff() 64k numbers vs [], 3.13.0: 10.8 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="505.09" y="41">392×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="86" text-anchor="end">diff() 20k objects vs half</text>
|
||||
<line class="nj-charts-axis" x1="487.419" y1="82" x2="430.049" y2="82" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="493.419" cy="82" r="5"><title>diff() 20k objects vs half, 3.12.0: 122 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="423.049" cy="82" r="5"><title>diff() 20k objects vs half, 3.13.0: 4.13 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="458.234" y="75">30×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="120" text-anchor="end">parse() callback, 32k objects</text>
|
||||
<line class="nj-charts-axis" x1="538.106" y1="116" x2="452.39" y2="116" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="544.106" cy="116" r="5"><title>parse() callback, 32k objects, 3.12.0: 1398 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="445.39" cy="116" r="5"><title>parse() callback, 32k objects, 3.13.0: 12.1 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="494.748" y="109">116×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="154" text-anchor="end">operator< nested 24 deep</text>
|
||||
<line class="nj-charts-axis" x1="474.14" y1="150" x2="271.406" y2="150" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="480.14" cy="150" r="5"><title>operator< nested 24 deep, 3.12.0: 64.4 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="264.406" cy="150" r="5"><title>operator< nested 24 deep, 3.13.0: 0.002 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="372.273" y="143">32200×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="188" text-anchor="end">operator< citm, 10x</text>
|
||||
<line class="nj-charts-axis" x1="504.98" y1="184" x2="429.07" y2="184" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="510.98" cy="184" r="5"><title>operator< citm, 10x, 3.12.0: 284 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="422.07" cy="184" r="5"><title>operator< citm, 10x, 3.13.0: 3.94 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="466.525" y="177">72×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="222" text-anchor="end">flatten() citm, ordered_json</text>
|
||||
<line class="nj-charts-axis" x1="504.006" y1="218" x2="408.294" y2="218" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="510.006" cy="218" r="5"><title>flatten() citm, ordered_json, 3.12.0: 271 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="401.294" cy="218" r="5"><title>flatten() citm, ordered_json, 3.13.0: 1.45 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="455.65" y="211">187×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="256" text-anchor="end">to_bson() 200 deep, 100x</text>
|
||||
<line class="nj-charts-axis" x1="450.144" y1="252" x2="378.87" y2="252" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="456.144" cy="252" r="5"><title>to_bson() 200 deep, 100x, 3.12.0: 20.3 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="371.87" cy="252" r="5"><title>to_bson() 200 deep, 100x, 3.13.0: 0.352 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="414.007" y="245">58×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="290" text-anchor="end">push_back() 100k, diagnostics</text>
|
||||
<line class="nj-charts-axis" x1="540.768" y1="286" x2="435.311" y2="286" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="546.768" cy="286" r="5"><title>push_back() 100k, diagnostics, 3.12.0: 1589 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="428.311" cy="286" r="5"><title>push_back() 100k, diagnostics, 3.13.0: 5.32 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="487.54" y="279">299×</text>
|
||||
<text class="nj-charts-rowlabel" x="240" y="324" text-anchor="end">at(i) 10k, diagnostics</text>
|
||||
<line class="nj-charts-axis" x1="467.101" y1="320" x2="350.057" y2="320" marker-end="url(#nj-blog-cliffs-head)"/>
|
||||
<circle class="nj-charts-ojson-dot" cx="473.101" cy="320" r="5"><title>at(i) 10k, diagnostics, 3.12.0: 45.9 ms</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="343.057" cy="320" r="5"><title>at(i) 10k, diagnostics, 3.13.0: 0.088 ms</title></circle>
|
||||
<text class="nj-charts-factor" x="408.079" y="313">522×</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.2 KiB |
@@ -0,0 +1,66 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--swar" viewBox="0 0 600 430" role="img" aria-labelledby="nj-blog-digits nj-blog-digits-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-digits">Converting eight A​SCII digits to their value with three multiplications</title>
|
||||
<desc id="nj-blog-digits-d">The text 12345678 as one word. Masking gives the digit values 1 to 8, one per byte. Multiplying by 10 times 2 to the 8 plus 1 and shifting gives 12, 34, 56 and 78 in 16-bit lanes; multiplying by 100 times 2 to the 16 plus 1 gives 1234 and 5678 in 32-bit lanes; multiplying by 10000 times 2 to the 32 plus 1 gives 12345678.</desc>
|
||||
<text class="fg-h" x="40" y="20">eight A​SCII digits in one 64-bit word (byte 0 is the lowest)</text>
|
||||
<rect class="fg-cell" x="40" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="69" y="53" text-anchor="middle">1</text>
|
||||
<text class="nj-charts-tick" x="69" y="80">0x31</text>
|
||||
<rect class="fg-cell" x="104" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="133" y="53" text-anchor="middle">2</text>
|
||||
<text class="nj-charts-tick" x="133" y="80">0x32</text>
|
||||
<rect class="fg-cell" x="168" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="197" y="53" text-anchor="middle">3</text>
|
||||
<text class="nj-charts-tick" x="197" y="80">0x33</text>
|
||||
<rect class="fg-cell" x="232" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="261" y="53" text-anchor="middle">4</text>
|
||||
<text class="nj-charts-tick" x="261" y="80">0x34</text>
|
||||
<rect class="fg-cell" x="296" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="325" y="53" text-anchor="middle">5</text>
|
||||
<text class="nj-charts-tick" x="325" y="80">0x35</text>
|
||||
<rect class="fg-cell" x="360" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="389" y="53" text-anchor="middle">6</text>
|
||||
<text class="nj-charts-tick" x="389" y="80">0x36</text>
|
||||
<rect class="fg-cell" x="424" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="453" y="53" text-anchor="middle">7</text>
|
||||
<text class="nj-charts-tick" x="453" y="80">0x37</text>
|
||||
<rect class="fg-cell" x="488" y="30" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="517" y="53" text-anchor="middle">8</text>
|
||||
<text class="nj-charts-tick" x="517" y="80">0x38</text>
|
||||
<text class="fg-h" x="40" y="112">& 0x0F0F0F0F0F0F0F0F: one digit value per byte</text>
|
||||
<rect class="fg-cell" x="40" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="69" y="145" text-anchor="middle">1</text>
|
||||
<rect class="fg-cell" x="104" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="133" y="145" text-anchor="middle">2</text>
|
||||
<rect class="fg-cell" x="168" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="197" y="145" text-anchor="middle">3</text>
|
||||
<rect class="fg-cell" x="232" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="261" y="145" text-anchor="middle">4</text>
|
||||
<rect class="fg-cell" x="296" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="325" y="145" text-anchor="middle">5</text>
|
||||
<rect class="fg-cell" x="360" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="389" y="145" text-anchor="middle">6</text>
|
||||
<rect class="fg-cell" x="424" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="453" y="145" text-anchor="middle">7</text>
|
||||
<rect class="fg-cell" x="488" y="122" width="58" height="34" rx="4"/>
|
||||
<text class="fg-code" x="517" y="145" text-anchor="middle">8</text>
|
||||
<text class="fg-h" x="40" y="186">× (10 · 2⁸ + 1) >> 8, every second byte kept: two digits per 16 bits</text>
|
||||
<rect class="fg-cell" x="40" y="196" width="122" height="34" rx="4"/>
|
||||
<text class="fg-code" x="101" y="219" text-anchor="middle">12</text>
|
||||
<rect class="fg-cell" x="168" y="196" width="122" height="34" rx="4"/>
|
||||
<text class="fg-code" x="229" y="219" text-anchor="middle">34</text>
|
||||
<rect class="fg-cell" x="296" y="196" width="122" height="34" rx="4"/>
|
||||
<text class="fg-code" x="357" y="219" text-anchor="middle">56</text>
|
||||
<rect class="fg-cell" x="424" y="196" width="122" height="34" rx="4"/>
|
||||
<text class="fg-code" x="485" y="219" text-anchor="middle">78</text>
|
||||
<text class="fg-h" x="40" y="260">× (100 · 2¹⁶ + 1) >> 16, every second lane kept: four digits per 32 bits</text>
|
||||
<rect class="fg-cell" x="40" y="270" width="250" height="34" rx="4"/>
|
||||
<text class="fg-code" x="165" y="293" text-anchor="middle">1234</text>
|
||||
<rect class="fg-cell" x="296" y="270" width="250" height="34" rx="4"/>
|
||||
<text class="fg-code" x="421" y="293" text-anchor="middle">5678</text>
|
||||
<text class="fg-h" x="40" y="334">× (10000 · 2³² + 1) >> 32: the value</text>
|
||||
<rect class="fg-cell" x="40" y="344" width="506" height="34" rx="4"/>
|
||||
<rect class="nj-charts-c1" fill-opacity=".25" x="40" y="344" width="506" height="34" rx="4"/>
|
||||
<text class="fg-code" x="293" y="367" text-anchor="middle">12345678</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="400">Each step combines neighboring lanes, in all lanes of the word at once:</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="418">three multiplications instead of eight, and no branch.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,36 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog" viewBox="0 0 560 250" role="img" aria-labelledby="nj-blog-dist nj-blog-dist-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-dist">Speedup of 3.13.0 over 3.12.0 for all 182 benchmarks of the suite</title>
|
||||
<desc id="nj-blog-dist-d">Bars counting the benchmarks per speedup range: below 1x: 1; 1 to 1.5x: 22; 1.5 to 2x: 12; 2 to 3x: 60; 3 to 5x: 58; 5 to 10x: 25; 10x or more: 4. Median 2.9x, geometric mean 3.0x.</desc>
|
||||
<line class="nj-charts-grid" x1="52" y1="196" x2="548" y2="196"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="46" y="200">0</text>
|
||||
<line class="nj-charts-grid" x1="52" y1="144.571" x2="548" y2="144.571"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="46" y="148.571">20</text>
|
||||
<line class="nj-charts-grid" x1="52" y1="93.1429" x2="548" y2="93.1429"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="46" y="97.1429">40</text>
|
||||
<line class="nj-charts-grid" x1="52" y1="41.7143" x2="548" y2="41.7143"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="46" y="45.7143">60</text>
|
||||
<rect class="nj-charts-c2" x="60.0" y="193.4" width="54.9" height="2.6" rx="3"><title>below 1×: 1</title></rect>
|
||||
<text class="nj-charts-val" x="87.4" y="188.4" text-anchor="middle">1</text>
|
||||
<text class="nj-charts-tick" x="87.4" y="212.0">below 1×</text>
|
||||
<rect class="nj-charts-c1" x="130.9" y="139.4" width="54.9" height="56.6" rx="3"><title>1 to 1.5×: 22</title></rect>
|
||||
<text class="nj-charts-val" x="158.3" y="134.4" text-anchor="middle">22</text>
|
||||
<text class="nj-charts-tick" x="158.3" y="212.0">1 to 1.5×</text>
|
||||
<rect class="nj-charts-c1" x="201.7" y="165.1" width="54.9" height="30.9" rx="3"><title>1.5 to 2×: 12</title></rect>
|
||||
<text class="nj-charts-val" x="229.1" y="160.1" text-anchor="middle">12</text>
|
||||
<text class="nj-charts-tick" x="229.1" y="212.0">1.5 to 2×</text>
|
||||
<rect class="nj-charts-c1" x="272.6" y="41.7" width="54.9" height="154.3" rx="3"><title>2 to 3×: 60</title></rect>
|
||||
<text class="nj-charts-val" x="300.0" y="36.7" text-anchor="middle">60</text>
|
||||
<text class="nj-charts-tick" x="300.0" y="212.0">2 to 3×</text>
|
||||
<rect class="nj-charts-c1" x="343.4" y="46.9" width="54.9" height="149.1" rx="3"><title>3 to 5×: 58</title></rect>
|
||||
<text class="nj-charts-val" x="370.9" y="41.9" text-anchor="middle">58</text>
|
||||
<text class="nj-charts-tick" x="370.9" y="212.0">3 to 5×</text>
|
||||
<rect class="nj-charts-c1" x="414.3" y="131.7" width="54.9" height="64.3" rx="3"><title>5 to 10×: 25</title></rect>
|
||||
<text class="nj-charts-val" x="441.7" y="126.7" text-anchor="middle">25</text>
|
||||
<text class="nj-charts-tick" x="441.7" y="212.0">5 to 10×</text>
|
||||
<rect class="nj-charts-c1" x="485.1" y="185.7" width="54.9" height="10.3" rx="3"><title>10× or more: 4</title></rect>
|
||||
<text class="nj-charts-val" x="512.6" y="180.7" text-anchor="middle">4</text>
|
||||
<text class="nj-charts-tick" x="512.6" y="212.0">10× or more</text>
|
||||
<line class="nj-charts-axis" x1="52" y1="196" x2="548" y2="196"/>
|
||||
<text class="nj-charts-tick" x="300" y="240">speedup over 3.12.0, more is better</text>
|
||||
<text class="nj-charts-tick" transform="rotate(-90)" x="-106" y="14">number of benchmarks</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,102 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog" viewBox="0 0 620 482" role="img" aria-labelledby="nj-blog-heldout nj-blog-heldout-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-heldout">Validating 19 files 3.13.0 was not tuned on: json_document's time relative to the fastest other library per file</title>
|
||||
<desc id="nj-blog-heldout-d">Dot plot per file, less is better; below 1.0 json_document is the fastest fully validating library. mesh: Mac 0.68, x86-64 0.44 (serde_json (Rust)); marine_ik: Mac 0.59, x86-64 0.64 (Boost.J​SON); semanticscholar-corpus: Mac 0.79, x86-64 0.65 (sonic-rs (Rust)); gsoc-2018: Mac 0.60, x86-64 0.66 (Boost.J​SON); twitter_api_compact_response: Mac 0.91, x86-64 0.70 (simdjson); twitterescaped: Mac 0.93, x86-64 0.76 (simdjson); numbers: Mac 0.67, x86-64 0.77 (Boost.J​SON); github_events: Mac 0.79, x86-64 0.77 (simdjson); update-center: Mac 0.88, x86-64 0.79 (simdjson); twitter_timeline: Mac 0.97, x86-64 0.80 (yyjson); twitter_api_response: Mac 0.93, x86-64 0.81 (simdjson); google_maps_api_compact_response: Mac 0.86, x86-64 0.81 (yyjson); repeat: Mac 0.65, x86-64 0.82 (simdjson); random: Mac 0.81, x86-64 0.88 (simdjson); apache_builds: Mac 1.08, x86-64 0.90 (simdjson); instruments: Mac 0.90, x86-64 0.92 (simdjson); mesh.pretty: Mac 0.86, x86-64 0.92 (Boost.J​SON); tree-pretty: Mac 0.93, x86-64 0.96 (simdjson); google_maps_api_response: Mac 0.93, x86-64 0.99 (simdjson).</desc>
|
||||
<line class="nj-charts-grid" x1="262" y1="50" x2="262" y2="438"/>
|
||||
<text class="nj-charts-tick" x="262" y="454">0.4×</text>
|
||||
<line class="nj-charts-grid" x1="291.867" y1="50" x2="291.867" y2="438"/>
|
||||
<text class="nj-charts-tick" x="291.867" y="454">0.5×</text>
|
||||
<line class="nj-charts-grid" x1="321.733" y1="50" x2="321.733" y2="438"/>
|
||||
<text class="nj-charts-tick" x="321.733" y="454">0.6×</text>
|
||||
<line class="nj-charts-grid" x1="351.6" y1="50" x2="351.6" y2="438"/>
|
||||
<text class="nj-charts-tick" x="351.6" y="454">0.7×</text>
|
||||
<line class="nj-charts-grid" x1="381.467" y1="50" x2="381.467" y2="438"/>
|
||||
<text class="nj-charts-tick" x="381.467" y="454">0.8×</text>
|
||||
<line class="nj-charts-grid" x1="411.333" y1="50" x2="411.333" y2="438"/>
|
||||
<text class="nj-charts-tick" x="411.333" y="454">0.9×</text>
|
||||
<line class="nj-charts-grid" x1="441.2" y1="50" x2="441.2" y2="438"/>
|
||||
<text class="nj-charts-tick" x="441.2" y="454">1.0×</text>
|
||||
<line class="nj-charts-grid" x1="471.067" y1="50" x2="471.067" y2="438"/>
|
||||
<text class="nj-charts-tick" x="471.067" y="454">1.1×</text>
|
||||
<text class="nj-charts-tick" x="374" y="472">json_document’s time / the fastest other library’s, less is better</text>
|
||||
<circle class="nj-charts-json-dot" cx="13" cy="14" r="5"/><text class="nj-charts-leg" x="23" y="18.5">Apple M1 Max</text>
|
||||
<circle class="nj-charts-ojson-dot" cx="134.2" cy="14" r="5"/><text class="nj-charts-leg" x="144.2" y="18.5">x86-64, G​CC 16.2</text>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="48">next on x86-64</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="68" text-anchor="end">mesh</text>
|
||||
<circle class="nj-charts-json-dot" cx="344.8" cy="60.5" r="4.5"><title>mesh, Apple M1 Max: 0.68× the time of Glaze</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="273.6" cy="67.5" r="4.5"><title>mesh, x86-64, G​CC 16.2: 0.44× the time of serde_json (Rust)</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="68">serde_json (Rust)</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="88" text-anchor="end">marine_ik</text>
|
||||
<circle class="nj-charts-json-dot" cx="319.5" cy="80.5" r="4.5"><title>marine_ik, Apple M1 Max: 0.59× the time of Glaze</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="334.2" cy="87.5" r="4.5"><title>marine_ik, x86-64, G​CC 16.2: 0.64× the time of Boost.J​SON</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="88">Boost.J​SON</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="108" text-anchor="end">semanticscholar-corpus</text>
|
||||
<circle class="nj-charts-json-dot" cx="377.9" cy="100.5" r="4.5"><title>semanticscholar-corpus, Apple M1 Max: 0.79× the time of sonic-rs (Rust)</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="336.0" cy="107.5" r="4.5"><title>semanticscholar-corpus, x86-64, G​CC 16.2: 0.65× the time of sonic-rs (Rust)</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="108">sonic-rs (Rust)</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="128" text-anchor="end">gsoc-2018</text>
|
||||
<circle class="nj-charts-json-dot" cx="322.9" cy="120.5" r="4.5"><title>gsoc-2018, Apple M1 Max: 0.60× the time of sonic-rs (Rust)</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="338.8" cy="127.5" r="4.5"><title>gsoc-2018, x86-64, G​CC 16.2: 0.66× the time of Boost.J​SON</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="128">Boost.J​SON</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="148" text-anchor="end">twitter_api_compact_response</text>
|
||||
<circle class="nj-charts-json-dot" cx="414.0" cy="140.5" r="4.5"><title>twitter_api_compact_response, Apple M1 Max: 0.91× the time of yyjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="352.1" cy="147.5" r="4.5"><title>twitter_api_compact_response, x86-64, G​CC 16.2: 0.70× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="148">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="168" text-anchor="end">twitterescaped</text>
|
||||
<circle class="nj-charts-json-dot" cx="419.5" cy="160.5" r="4.5"><title>twitterescaped, Apple M1 Max: 0.93× the time of yyjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="370.8" cy="167.5" r="4.5"><title>twitterescaped, x86-64, G​CC 16.2: 0.76× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="168">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="188" text-anchor="end">numbers</text>
|
||||
<circle class="nj-charts-json-dot" cx="343.3" cy="180.5" r="4.5"><title>numbers, Apple M1 Max: 0.67× the time of Boost.J​SON</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="373.1" cy="187.5" r="4.5"><title>numbers, x86-64, G​CC 16.2: 0.77× the time of Boost.J​SON</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="188">Boost.J​SON</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="208" text-anchor="end">github_events</text>
|
||||
<circle class="nj-charts-json-dot" cx="379.5" cy="200.5" r="4.5"><title>github_events, Apple M1 Max: 0.79× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="373.4" cy="207.5" r="4.5"><title>github_events, x86-64, G​CC 16.2: 0.77× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="208">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="228" text-anchor="end">update-center</text>
|
||||
<circle class="nj-charts-json-dot" cx="405.1" cy="220.5" r="4.5"><title>update-center, Apple M1 Max: 0.88× the time of sonic-rs (Rust)</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="377.7" cy="227.5" r="4.5"><title>update-center, x86-64, G​CC 16.2: 0.79× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="228">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="248" text-anchor="end">twitter_timeline</text>
|
||||
<circle class="nj-charts-json-dot" cx="431.6" cy="240.5" r="4.5"><title>twitter_timeline, Apple M1 Max: 0.97× the time of yyjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="381.3" cy="247.5" r="4.5"><title>twitter_timeline, x86-64, G​CC 16.2: 0.80× the time of yyjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="248">yyjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="268" text-anchor="end">twitter_api_response</text>
|
||||
<circle class="nj-charts-json-dot" cx="420.4" cy="260.5" r="4.5"><title>twitter_api_response, Apple M1 Max: 0.93× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="384.1" cy="267.5" r="4.5"><title>twitter_api_response, x86-64, G​CC 16.2: 0.81× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="268">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="288" text-anchor="end">google_maps_api_compact_response</text>
|
||||
<circle class="nj-charts-json-dot" cx="399.2" cy="280.5" r="4.5"><title>google_maps_api_compact_response, Apple M1 Max: 0.86× the time of yyjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="384.2" cy="287.5" r="4.5"><title>google_maps_api_compact_response, x86-64, G​CC 16.2: 0.81× the time of yyjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="288">yyjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="308" text-anchor="end">repeat</text>
|
||||
<circle class="nj-charts-json-dot" cx="336.7" cy="300.5" r="4.5"><title>repeat, Apple M1 Max: 0.65× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="388.2" cy="307.5" r="4.5"><title>repeat, x86-64, G​CC 16.2: 0.82× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="308">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="328" text-anchor="end">random</text>
|
||||
<circle class="nj-charts-json-dot" cx="383.7" cy="320.5" r="4.5"><title>random, Apple M1 Max: 0.81× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="404.9" cy="327.5" r="4.5"><title>random, x86-64, G​CC 16.2: 0.88× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="328">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="348" text-anchor="end">apache_builds</text>
|
||||
<circle class="nj-charts-json-dot" cx="463.6" cy="340.5" r="4.5"><title>apache_builds, Apple M1 Max: 1.08× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="412.4" cy="347.5" r="4.5"><title>apache_builds, x86-64, G​CC 16.2: 0.90× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="348">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="368" text-anchor="end">instruments</text>
|
||||
<circle class="nj-charts-json-dot" cx="412.5" cy="360.5" r="4.5"><title>instruments, Apple M1 Max: 0.90× the time of yyjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="416.2" cy="367.5" r="4.5"><title>instruments, x86-64, G​CC 16.2: 0.92× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="368">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="388" text-anchor="end">mesh.pretty</text>
|
||||
<circle class="nj-charts-json-dot" cx="398.9" cy="380.5" r="4.5"><title>mesh.pretty, Apple M1 Max: 0.86× the time of Glaze</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="418.6" cy="387.5" r="4.5"><title>mesh.pretty, x86-64, G​CC 16.2: 0.92× the time of Boost.J​SON</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="388">Boost.J​SON</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="408" text-anchor="end">tree-pretty</text>
|
||||
<circle class="nj-charts-json-dot" cx="420.1" cy="400.5" r="4.5"><title>tree-pretty, Apple M1 Max: 0.93× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="429.3" cy="407.5" r="4.5"><title>tree-pretty, x86-64, G​CC 16.2: 0.96× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="408">simdjson</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="252" y="428" text-anchor="end">google_maps_api_response</text>
|
||||
<circle class="nj-charts-json-dot" cx="419.0" cy="420.5" r="4.5"><title>google_maps_api_response, Apple M1 Max: 0.93× the time of simdjson</title></circle>
|
||||
<circle class="nj-charts-ojson-dot" cx="439.0" cy="427.5" r="4.5"><title>google_maps_api_response, x86-64, G​CC 16.2: 0.99× the time of simdjson</title></circle>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="500" y="428">simdjson</text>
|
||||
<line class="nj-charts-ref" x1="441.2" y1="50" x2="441.2" y2="438"/>
|
||||
<text class="nj-charts-tick" x="441.2" y="44">as fast as the next</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,72 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--swar" viewBox="0 0 640 294" role="img" aria-labelledby="nj-blog-overlap nj-blog-overlap-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-overlap">Writing an 18-byte string with two overlapping 16-byte loads and stores</title>
|
||||
<desc id="nj-blog-overlap-d">The 18 bytes of profile_link_color. Load a covers bytes 0 to 15, load b covers bytes 2 to 17, so bytes 2 to 15 are in both. Neither contains a byte that needs escaping, so a is stored at the destination and b 2 bytes later; the second store writes bytes 2 to 15 again with the same values. This works for any length from 16 to 32 bytes without a loop.</desc>
|
||||
<text class="fg-h" x="40" y="20">a string of n = 18 bytes: too long for one 16-byte vector, too short for a loop</text>
|
||||
<rect class="fg-cell" x="40" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="53.5" y="58" text-anchor="middle">p</text>
|
||||
<rect class="fg-cell" x="71" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="84.5" y="58" text-anchor="middle">r</text>
|
||||
<rect class="fg-cell" x="102" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="102" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="115.5" y="58" text-anchor="middle">o</text>
|
||||
<rect class="fg-cell" x="133" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="133" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="146.5" y="58" text-anchor="middle">f</text>
|
||||
<rect class="fg-cell" x="164" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="164" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="177.5" y="58" text-anchor="middle">i</text>
|
||||
<rect class="fg-cell" x="195" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="195" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="208.5" y="58" text-anchor="middle">l</text>
|
||||
<rect class="fg-cell" x="226" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="226" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="239.5" y="58" text-anchor="middle">e</text>
|
||||
<rect class="fg-cell" x="257" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="257" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="270.5" y="58" text-anchor="middle">_</text>
|
||||
<rect class="fg-cell" x="288" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="288" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="301.5" y="58" text-anchor="middle">l</text>
|
||||
<rect class="fg-cell" x="319" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="319" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="332.5" y="58" text-anchor="middle">i</text>
|
||||
<rect class="fg-cell" x="350" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="350" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="363.5" y="58" text-anchor="middle">n</text>
|
||||
<rect class="fg-cell" x="381" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="381" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="394.5" y="58" text-anchor="middle">k</text>
|
||||
<rect class="fg-cell" x="412" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="412" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="425.5" y="58" text-anchor="middle">_</text>
|
||||
<rect class="fg-cell" x="443" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="443" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="456.5" y="58" text-anchor="middle">c</text>
|
||||
<rect class="fg-cell" x="474" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="474" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="487.5" y="58" text-anchor="middle">o</text>
|
||||
<rect class="fg-cell" x="505" y="34" width="27" height="36" rx="4"/>
|
||||
<rect class="nj-charts-c3" fill-opacity=".3" x="505" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="518.5" y="58" text-anchor="middle">l</text>
|
||||
<rect class="fg-cell" x="536" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="549.5" y="58" text-anchor="middle">o</text>
|
||||
<rect class="fg-cell" x="567" y="34" width="27" height="36" rx="4"/>
|
||||
<text class="fg-code" x="580.5" y="58" text-anchor="middle">r</text>
|
||||
<text class="nj-charts-tick" x="53.5" y="86">0</text>
|
||||
<text class="nj-charts-tick" x="115.5" y="86">2</text>
|
||||
<text class="nj-charts-tick" x="518.5" y="86">15</text>
|
||||
<text class="nj-charts-tick" x="580.5" y="86">17</text>
|
||||
<rect class="nj-charts-c1" fill-opacity=".22" x="40" y="100" width="492" height="22" rx="4"/>
|
||||
<rect class="nj-charts-c1" x="40" y="100" width="4" height="22" rx="2"/>
|
||||
<rect class="nj-charts-c1" x="528" y="100" width="4" height="22" rx="2"/>
|
||||
<text class="fg-code" x="286" y="116" text-anchor="middle" style="font-size:14px">a = load 16 bytes at p</text>
|
||||
<rect class="nj-charts-c2" fill-opacity=".22" x="102" y="130" width="492" height="22" rx="4"/>
|
||||
<rect class="nj-charts-c2" x="102" y="130" width="4" height="22" rx="2"/>
|
||||
<rect class="nj-charts-c2" x="590" y="130" width="4" height="22" rx="2"/>
|
||||
<text class="fg-code" x="348" y="146" text-anchor="middle" style="font-size:14px">b = load 16 bytes at p + n − 16</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="182">Both loads lie inside the string, and together they cover all of it; bytes 2 to 15 are in both.</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="204">Test a and b for a quote, a backslash, a control character or 0x7F: none, so write</text>
|
||||
<text class="fg-code" x="40" y="234">store a at d, store b at d + n − 16</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="262">The second store writes bytes 2 to 15 again, with the same values. For any n from 16 to 32:</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="280">two loads, one test, two stores, no loop and no branch on the length.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.0 KiB |
@@ -0,0 +1,87 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog" viewBox="0 0 560 604" role="img" aria-labelledby="nj-blog-overview nj-blog-overview-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-overview">Speedup of 3.13.0 over 3.12.0 per workload, Apple M1 Max, Apple clang</title>
|
||||
<desc id="nj-blog-overview-d">Horizontal bars of the speedup, more is better. twitter.json 3.1x; citm_catalog.json 4.2x; canada.json 3.4x; canada.json, indented 6.5x; citm, ordered_json 6.8x; twitter, std::ifstream 2.5x; citm, FILE* 4.7x; citm, accept() 7.1x; dump() twitter 6.7x; dump() canada 3.0x; dump(4) citm 4.7x; to_cbor() twitter 4.6x; twitter, memory 3.4x; twitter, FILE* 6.6x; diff() canada 10x; iterate canada 2.7x; copy + destroy citm 1.13x; == citm 1.06x.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="20">Parsing</text>
|
||||
<text class="nj-charts-panel" x="8" y="244">Writing</text>
|
||||
<text class="nj-charts-panel" x="8" y="372">Reading C​BOR</text>
|
||||
<text class="nj-charts-panel" x="8" y="452">Values</text>
|
||||
<line class="nj-charts-grid" x1="220" y1="8" x2="220" y2="560"/>
|
||||
<text class="nj-charts-tick" x="220" y="576">1×</text>
|
||||
<line class="nj-charts-grid" x1="250" y1="8" x2="250" y2="560"/>
|
||||
<text class="nj-charts-tick" x="250" y="576">2×</text>
|
||||
<line class="nj-charts-grid" x1="280" y1="8" x2="280" y2="560"/>
|
||||
<text class="nj-charts-tick" x="280" y="576">3×</text>
|
||||
<line class="nj-charts-grid" x1="310" y1="8" x2="310" y2="560"/>
|
||||
<text class="nj-charts-tick" x="310" y="576">4×</text>
|
||||
<line class="nj-charts-grid" x1="340" y1="8" x2="340" y2="560"/>
|
||||
<text class="nj-charts-tick" x="340" y="576">5×</text>
|
||||
<line class="nj-charts-grid" x1="370" y1="8" x2="370" y2="560"/>
|
||||
<text class="nj-charts-tick" x="370" y="576">6×</text>
|
||||
<line class="nj-charts-grid" x1="400" y1="8" x2="400" y2="560"/>
|
||||
<text class="nj-charts-tick" x="400" y="576">7×</text>
|
||||
<line class="nj-charts-grid" x1="430" y1="8" x2="430" y2="560"/>
|
||||
<text class="nj-charts-tick" x="430" y="576">8×</text>
|
||||
<line class="nj-charts-grid" x1="460" y1="8" x2="460" y2="560"/>
|
||||
<text class="nj-charts-tick" x="460" y="576">9×</text>
|
||||
<line class="nj-charts-grid" x1="490" y1="8" x2="490" y2="560"/>
|
||||
<text class="nj-charts-tick" x="490" y="576">10×</text>
|
||||
<line class="nj-charts-grid" x1="520" y1="8" x2="520" y2="560"/>
|
||||
<text class="nj-charts-tick" x="520" y="576">11×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="42" text-anchor="end">twitter.json</text>
|
||||
<path class="nj-charts-c1" d="M190 30 H280.2 Q284.2 30 284.2 34 V41 Q284.2 45 280.2 45 H190 Z"><title>twitter.json: 3.1×</title></path>
|
||||
<text class="nj-charts-val" x="289.2" y="42">3.1×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="66" text-anchor="end">citm_catalog.json</text>
|
||||
<path class="nj-charts-c1" d="M190 54 H313.5 Q317.5 54 317.5 58 V65 Q317.5 69 313.5 69 H190 Z"><title>citm_catalog.json: 4.2×</title></path>
|
||||
<text class="nj-charts-val" x="322.5" y="66">4.2×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="90" text-anchor="end">canada.json</text>
|
||||
<path class="nj-charts-c1" d="M190 78 H286.5 Q290.5 78 290.5 82 V89 Q290.5 93 286.5 93 H190 Z"><title>canada.json: 3.4×</title></path>
|
||||
<text class="nj-charts-val" x="295.5" y="90">3.4×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="114" text-anchor="end">canada.json, indented</text>
|
||||
<path class="nj-charts-c1" d="M190 102 H381.3 Q385.3 102 385.3 106 V113 Q385.3 117 381.3 117 H190 Z"><title>canada.json, indented: 6.5×</title></path>
|
||||
<text class="nj-charts-val" x="390.3" y="114">6.5×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="138" text-anchor="end">citm, ordered_json</text>
|
||||
<path class="nj-charts-c1" d="M190 126 H391.5 Q395.5 126 395.5 130 V137 Q395.5 141 391.5 141 H190 Z"><title>citm, ordered_json: 6.8×</title></path>
|
||||
<text class="nj-charts-val" x="400.5" y="138">6.8×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="162" text-anchor="end">twitter, std::ifstream</text>
|
||||
<path class="nj-charts-c1" d="M190 150 H261 Q265 150 265 154 V161 Q265 165 261 165 H190 Z"><title>twitter, std::ifstream: 2.5×</title></path>
|
||||
<text class="nj-charts-val" x="270" y="162">2.5×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="186" text-anchor="end">citm, FILE*</text>
|
||||
<path class="nj-charts-c1" d="M190 174 H328.2 Q332.2 174 332.2 178 V185 Q332.2 189 328.2 189 H190 Z"><title>citm, FILE*: 4.7×</title></path>
|
||||
<text class="nj-charts-val" x="337.2" y="186">4.7×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="210" text-anchor="end">citm, accept()</text>
|
||||
<path class="nj-charts-c1" d="M190 198 H398.1 Q402.1 198 402.1 202 V209 Q402.1 213 398.1 213 H190 Z"><title>citm, accept(): 7.1×</title></path>
|
||||
<text class="nj-charts-val" x="407.1" y="210">7.1×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="266" text-anchor="end">dump() twitter</text>
|
||||
<path class="nj-charts-c1" d="M190 254 H387 Q391 254 391 258 V265 Q391 269 387 269 H190 Z"><title>dump() twitter: 6.7×</title></path>
|
||||
<text class="nj-charts-val" x="396" y="266">6.7×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="290" text-anchor="end">dump() canada</text>
|
||||
<path class="nj-charts-c1" d="M190 278 H275.4 Q279.4 278 279.4 282 V289 Q279.4 293 275.4 293 H190 Z"><title>dump() canada: 3.0×</title></path>
|
||||
<text class="nj-charts-val" x="284.4" y="290">3.0×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="314" text-anchor="end">dump(4) citm</text>
|
||||
<path class="nj-charts-c1" d="M190 302 H327 Q331 302 331 306 V313 Q331 317 327 317 H190 Z"><title>dump(4) citm: 4.7×</title></path>
|
||||
<text class="nj-charts-val" x="336" y="314">4.7×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="338" text-anchor="end">to_cbor() twitter</text>
|
||||
<path class="nj-charts-c1" d="M190 326 H323.7 Q327.7 326 327.7 330 V337 Q327.7 341 323.7 341 H190 Z"><title>to_cbor() twitter: 4.6×</title></path>
|
||||
<text class="nj-charts-val" x="332.7" y="338">4.6×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="394" text-anchor="end">twitter, memory</text>
|
||||
<path class="nj-charts-c1" d="M190 382 H287.7 Q291.7 382 291.7 386 V393 Q291.7 397 287.7 397 H190 Z"><title>twitter, memory: 3.4×</title></path>
|
||||
<text class="nj-charts-val" x="296.7" y="394">3.4×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="418" text-anchor="end">twitter, FILE*</text>
|
||||
<path class="nj-charts-c1" d="M190 406 H383.7 Q387.7 406 387.7 410 V417 Q387.7 421 383.7 421 H190 Z"><title>twitter, FILE*: 6.6×</title></path>
|
||||
<text class="nj-charts-val" x="392.7" y="418">6.6×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="474" text-anchor="end">diff() canada</text>
|
||||
<path class="nj-charts-c1" d="M190 462 H499.8 Q503.8 462 503.8 466 V473 Q503.8 477 499.8 477 H190 Z"><title>diff() canada: 10×</title></path>
|
||||
<text class="nj-charts-val" x="508.8" y="474">10×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="498" text-anchor="end">iterate canada</text>
|
||||
<path class="nj-charts-c1" d="M190 486 H267.9 Q271.9 486 271.9 490 V497 Q271.9 501 267.9 501 H190 Z"><title>iterate canada: 2.7×</title></path>
|
||||
<text class="nj-charts-val" x="276.9" y="498">2.7×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="522" text-anchor="end">copy + destroy citm</text>
|
||||
<path class="nj-charts-c1" d="M190 510 H219.9 Q223.9 510 223.9 514 V521 Q223.9 525 219.9 525 H190 Z"><title>copy + destroy citm: 1.13×</title></path>
|
||||
<text class="nj-charts-val" x="228.9" y="522">1.13×</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-tick--r" x="182" y="546" text-anchor="end">== citm</text>
|
||||
<path class="nj-charts-c1" d="M190 534 H217.8 Q221.8 534 221.8 538 V545 Q221.8 549 217.8 549 H190 Z"><title>== citm: 1.06×</title></path>
|
||||
<text class="nj-charts-val" x="226.8" y="546">1.06×</text>
|
||||
<line class="nj-charts-ref" x1="220" y1="8" x2="220" y2="560"/>
|
||||
<line class="nj-charts-zero" x1="190" y1="8" x2="190" y2="560"/>
|
||||
<text class="nj-charts-tick" x="355" y="594">speedup over 3.12.0 (3.12.0 = 1×), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 8.1 KiB |
@@ -0,0 +1,99 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog" viewBox="0 0 600 618" role="img" aria-labelledby="nj-blog-price nj-blog-price-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-price">Compile time of two programs with 3.13.0, alone, with a precompiled header and as a module, compared with 3.12.0</title>
|
||||
<desc id="nj-blog-price-d">Horizontal bars of the change in compile time against 3.12.0, less is better. Apple clang 21, -O0 (debug), count_numbers, 3.13.0: +38%; Apple clang 21, -O0 (debug), count_numbers, 3.13.0, precompiled header: -28%; Apple clang 21, -O0 (debug), count_numbers, 3.13.0, module: -4%; Apple clang 21, -O0 (debug), server_config, 3.13.0: +34%; Apple clang 21, -O0 (debug), server_config, 3.13.0, precompiled header: -23%; Apple clang 21, -O0 (debug), server_config, 3.13.0, module: +2%; Apple clang 21, -O2, count_numbers, 3.13.0: +49%; Apple clang 21, -O2, count_numbers, 3.13.0, precompiled header: +5%; Apple clang 21, -O2, count_numbers, 3.13.0, module: +21%; Apple clang 21, -O2, server_config, 3.13.0: +45%; Apple clang 21, -O2, server_config, 3.13.0, precompiled header: +10%; Apple clang 21, -O2, server_config, 3.13.0, module: +24%; G​CC 16, -O0 (debug), count_numbers, 3.13.0: +62%; G​CC 16, -O0 (debug), count_numbers, 3.13.0, precompiled header: +10%; G​CC 16, -O0 (debug), count_numbers, 3.13.0, module: +8%; G​CC 16, -O0 (debug), server_config, 3.13.0: +47%; G​CC 16, -O0 (debug), server_config, 3.13.0, precompiled header: +14%; G​CC 16, -O0 (debug), server_config, 3.13.0, module: +15%; G​CC 16, -O2, count_numbers, 3.13.0: +58%; G​CC 16, -O2, count_numbers, 3.13.0, precompiled header: +28%; G​CC 16, -O2, count_numbers, 3.13.0, module: +25%; G​CC 16, -O2, server_config, 3.13.0: +51%; G​CC 16, -O2, server_config, 3.13.0, precompiled header: +28%; G​CC 16, -O2, server_config, 3.13.0, module: +30%.</desc>
|
||||
<rect class="nj-charts-c2" x="8" y="6" width="12" height="12" rx="3"/>
|
||||
<text class="nj-charts-leg" x="26" y="16.5">3.13.0</text>
|
||||
<rect class="nj-charts-c1" x="97.2" y="6" width="12" height="12" rx="3"/>
|
||||
<text class="nj-charts-leg" x="115.2" y="16.5">3.13.0, precompiled header</text>
|
||||
<rect class="nj-charts-c3" x="350.4" y="6" width="12" height="12" rx="3"/>
|
||||
<text class="nj-charts-leg" x="368.4" y="16.5">3.13.0, module</text>
|
||||
<text class="nj-charts-tick" x="320.833" y="46">as fast as 3.12.0</text>
|
||||
<text class="nj-charts-panel" x="8" y="68">Apple clang 21, -O0 (debug)</text>
|
||||
<line class="nj-charts-grid" x1="184.167" y1="74" x2="184.167" y2="170"/>
|
||||
<line class="nj-charts-grid" x1="252.5" y1="74" x2="252.5" y2="170"/>
|
||||
<line class="nj-charts-grid" x1="389.167" y1="74" x2="389.167" y2="170"/>
|
||||
<line class="nj-charts-grid" x1="457.5" y1="74" x2="457.5" y2="170"/>
|
||||
<line class="nj-charts-grid" x1="525.833" y1="74" x2="525.833" y2="170"/>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="101" text-anchor="end">count_numbers</text>
|
||||
<path class="nj-charts-c2" d="M320.833 78 H446.667 Q450.667 78 450.667 82 V85 Q450.667 89 446.667 89 H320.833 Z"><title>count_numbers, Apple clang 21, -O0 (debug), 3.13.0: 1,320 ms against 955 ms with 3.12.0 (+38%)</title></path>
|
||||
<text class="nj-charts-val" x="455.667" y="87.5">+38%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 92 H229.167 Q225.167 92 225.167 96 V99 Q225.167 103 229.167 103 H320.833 Z"><title>count_numbers, Apple clang 21, -O0 (debug), 3.13.0, precompiled header: 688 ms against 955 ms with 3.12.0 (−28%)</title></path>
|
||||
<text class="nj-charts-val" x="220.167" y="101.5" text-anchor="end">−28%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 106 H311.167 Q307.167 106 307.167 110 V113 Q307.167 117 311.167 117 H320.833 Z"><title>count_numbers, Apple clang 21, -O0 (debug), 3.13.0, module: 918 ms against 955 ms with 3.12.0 (−4%)</title></path>
|
||||
<text class="nj-charts-val" x="302.167" y="115.5" text-anchor="end">−4%</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="150" text-anchor="end">server_config</text>
|
||||
<path class="nj-charts-c2" d="M320.833 127 H433 Q437 127 437 131 V134 Q437 138 433 138 H320.833 Z"><title>server_config, Apple clang 21, -O0 (debug), 3.13.0: 1,496 ms against 1,113 ms with 3.12.0 (+34%)</title></path>
|
||||
<text class="nj-charts-val" x="442" y="136.5">+34%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 141 H246.25 Q242.25 141 242.25 145 V148 Q242.25 152 246.25 152 H320.833 Z"><title>server_config, Apple clang 21, -O0 (debug), 3.13.0, precompiled header: 863 ms against 1,113 ms with 3.12.0 (−23%)</title></path>
|
||||
<text class="nj-charts-val" x="237.25" y="150.5" text-anchor="end">−23%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 155 H323.667 Q327.667 155 327.667 159 V162 Q327.667 166 323.667 166 H320.833 Z"><title>server_config, Apple clang 21, -O0 (debug), 3.13.0, module: 1,136 ms against 1,113 ms with 3.12.0 (+2%)</title></path>
|
||||
<text class="nj-charts-val" x="332.667" y="164.5">+2%</text>
|
||||
<text class="nj-charts-panel" x="8" y="198">Apple clang 21, -O2</text>
|
||||
<line class="nj-charts-grid" x1="184.167" y1="204" x2="184.167" y2="300"/>
|
||||
<line class="nj-charts-grid" x1="252.5" y1="204" x2="252.5" y2="300"/>
|
||||
<line class="nj-charts-grid" x1="389.167" y1="204" x2="389.167" y2="300"/>
|
||||
<line class="nj-charts-grid" x1="457.5" y1="204" x2="457.5" y2="300"/>
|
||||
<line class="nj-charts-grid" x1="525.833" y1="204" x2="525.833" y2="300"/>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="231" text-anchor="end">count_numbers</text>
|
||||
<path class="nj-charts-c2" d="M320.833 208 H484.25 Q488.25 208 488.25 212 V215 Q488.25 219 484.25 219 H320.833 Z"><title>count_numbers, Apple clang 21, -O2, 3.13.0: 2,081 ms against 1,393 ms with 3.12.0 (+49%)</title></path>
|
||||
<text class="nj-charts-val" x="493.25" y="217.5">+49%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 222 H333.917 Q337.917 222 337.917 226 V229 Q337.917 233 333.917 233 H320.833 Z"><title>count_numbers, Apple clang 21, -O2, 3.13.0, precompiled header: 1,458 ms against 1,393 ms with 3.12.0 (+5%)</title></path>
|
||||
<text class="nj-charts-val" x="342.917" y="231.5">+5%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 236 H388.583 Q392.583 236 392.583 240 V243 Q392.583 247 388.583 247 H320.833 Z"><title>count_numbers, Apple clang 21, -O2, 3.13.0, module: 1,685 ms against 1,393 ms with 3.12.0 (+21%)</title></path>
|
||||
<text class="nj-charts-val" x="397.583" y="245.5">+21%</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="280" text-anchor="end">server_config</text>
|
||||
<path class="nj-charts-c2" d="M320.833 257 H470.583 Q474.583 257 474.583 261 V264 Q474.583 268 470.583 268 H320.833 Z"><title>server_config, Apple clang 21, -O2, 3.13.0: 2,546 ms against 1,754 ms with 3.12.0 (+45%)</title></path>
|
||||
<text class="nj-charts-val" x="479.583" y="266.5">+45%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 271 H351 Q355 271 355 275 V278 Q355 282 351 282 H320.833 Z"><title>server_config, Apple clang 21, -O2, 3.13.0, precompiled header: 1,925 ms against 1,754 ms with 3.12.0 (+10%)</title></path>
|
||||
<text class="nj-charts-val" x="360" y="280.5">+10%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 285 H398.833 Q402.833 285 402.833 289 V292 Q402.833 296 398.833 296 H320.833 Z"><title>server_config, Apple clang 21, -O2, 3.13.0, module: 2,169 ms against 1,754 ms with 3.12.0 (+24%)</title></path>
|
||||
<text class="nj-charts-val" x="407.833" y="294.5">+24%</text>
|
||||
<text class="nj-charts-panel" x="8" y="328">G​CC 16, -O0 (debug)</text>
|
||||
<line class="nj-charts-grid" x1="184.167" y1="334" x2="184.167" y2="430"/>
|
||||
<line class="nj-charts-grid" x1="252.5" y1="334" x2="252.5" y2="430"/>
|
||||
<line class="nj-charts-grid" x1="389.167" y1="334" x2="389.167" y2="430"/>
|
||||
<line class="nj-charts-grid" x1="457.5" y1="334" x2="457.5" y2="430"/>
|
||||
<line class="nj-charts-grid" x1="525.833" y1="334" x2="525.833" y2="430"/>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="361" text-anchor="end">count_numbers</text>
|
||||
<path class="nj-charts-c2" d="M320.833 338 H528.667 Q532.667 338 532.667 342 V345 Q532.667 349 528.667 349 H320.833 Z"><title>count_numbers, G​CC 16, -O0 (debug), 3.13.0: 2,548 ms against 1,569 ms with 3.12.0 (+62%)</title></path>
|
||||
<text class="nj-charts-val" x="537.667" y="347.5">+62%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 352 H351 Q355 352 355 356 V359 Q355 363 351 363 H320.833 Z"><title>count_numbers, G​CC 16, -O0 (debug), 3.13.0, precompiled header: 1,725 ms against 1,569 ms with 3.12.0 (+10%)</title></path>
|
||||
<text class="nj-charts-val" x="360" y="361.5">+10%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 366 H344.167 Q348.167 366 348.167 370 V373 Q348.167 377 344.167 377 H320.833 Z"><title>count_numbers, G​CC 16, -O0 (debug), 3.13.0, module: 1,700 ms against 1,569 ms with 3.12.0 (+8%)</title></path>
|
||||
<text class="nj-charts-val" x="353.167" y="375.5">+8%</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="410" text-anchor="end">server_config</text>
|
||||
<path class="nj-charts-c2" d="M320.833 387 H477.417 Q481.417 387 481.417 391 V394 Q481.417 398 477.417 398 H320.833 Z"><title>server_config, G​CC 16, -O0 (debug), 3.13.0: 2,985 ms against 2,025 ms with 3.12.0 (+47%)</title></path>
|
||||
<text class="nj-charts-val" x="486.417" y="396.5">+47%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 401 H364.667 Q368.667 401 368.667 405 V408 Q368.667 412 364.667 412 H320.833 Z"><title>server_config, G​CC 16, -O0 (debug), 3.13.0, precompiled header: 2,302 ms against 2,025 ms with 3.12.0 (+14%)</title></path>
|
||||
<text class="nj-charts-val" x="373.667" y="410.5">+14%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 415 H368.083 Q372.083 415 372.083 419 V422 Q372.083 426 368.083 426 H320.833 Z"><title>server_config, G​CC 16, -O0 (debug), 3.13.0, module: 2,326 ms against 2,025 ms with 3.12.0 (+15%)</title></path>
|
||||
<text class="nj-charts-val" x="377.083" y="424.5">+15%</text>
|
||||
<text class="nj-charts-panel" x="8" y="458">G​CC 16, -O2</text>
|
||||
<line class="nj-charts-grid" x1="184.167" y1="464" x2="184.167" y2="560"/>
|
||||
<line class="nj-charts-grid" x1="252.5" y1="464" x2="252.5" y2="560"/>
|
||||
<line class="nj-charts-grid" x1="389.167" y1="464" x2="389.167" y2="560"/>
|
||||
<line class="nj-charts-grid" x1="457.5" y1="464" x2="457.5" y2="560"/>
|
||||
<line class="nj-charts-grid" x1="525.833" y1="464" x2="525.833" y2="560"/>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="491" text-anchor="end">count_numbers</text>
|
||||
<path class="nj-charts-c2" d="M320.833 468 H515 Q519 468 519 472 V475 Q519 479 515 479 H320.833 Z"><title>count_numbers, G​CC 16, -O2, 3.13.0: 3,702 ms against 2,336 ms with 3.12.0 (+58%)</title></path>
|
||||
<text class="nj-charts-val" x="524" y="477.5">+58%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 482 H412.5 Q416.5 482 416.5 486 V489 Q416.5 493 412.5 493 H320.833 Z"><title>count_numbers, G​CC 16, -O2, 3.13.0, precompiled header: 2,987 ms against 2,336 ms with 3.12.0 (+28%)</title></path>
|
||||
<text class="nj-charts-val" x="421.5" y="491.5">+28%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 496 H402.25 Q406.25 496 406.25 500 V503 Q406.25 507 402.25 507 H320.833 Z"><title>count_numbers, G​CC 16, -O2, 3.13.0, module: 2,913 ms against 2,336 ms with 3.12.0 (+25%)</title></path>
|
||||
<text class="nj-charts-val" x="411.25" y="505.5">+25%</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-code" x="142" y="540" text-anchor="end">server_config</text>
|
||||
<path class="nj-charts-c2" d="M320.833 517 H491.083 Q495.083 517 495.083 521 V524 Q495.083 528 491.083 528 H320.833 Z"><title>server_config, G​CC 16, -O2, 3.13.0: 4,714 ms against 3,122 ms with 3.12.0 (+51%)</title></path>
|
||||
<text class="nj-charts-val" x="500.083" y="526.5">+51%</text>
|
||||
<path class="nj-charts-c1" d="M320.833 531 H412.5 Q416.5 531 416.5 535 V538 Q416.5 542 412.5 542 H320.833 Z"><title>server_config, G​CC 16, -O2, 3.13.0, precompiled header: 4,006 ms against 3,122 ms with 3.12.0 (+28%)</title></path>
|
||||
<text class="nj-charts-val" x="421.5" y="540.5">+28%</text>
|
||||
<path class="nj-charts-c3" d="M320.833 545 H419.333 Q423.333 545 423.333 549 V552 Q423.333 556 419.333 556 H320.833 Z"><title>server_config, G​CC 16, -O2, 3.13.0, module: 4,055 ms against 3,122 ms with 3.12.0 (+30%)</title></path>
|
||||
<text class="nj-charts-val" x="428.333" y="554.5">+30%</text>
|
||||
<line class="nj-charts-ref" x1="320.833" y1="52" x2="320.833" y2="574"/>
|
||||
<text class="nj-charts-tick" x="184.167" y="590">−40%</text>
|
||||
<text class="nj-charts-tick" x="252.5" y="590">−20%</text>
|
||||
<text class="nj-charts-tick" x="320.833" y="590">0</text>
|
||||
<text class="nj-charts-tick" x="389.167" y="590">+20%</text>
|
||||
<text class="nj-charts-tick" x="457.5" y="590">+40%</text>
|
||||
<text class="nj-charts-tick" x="525.833" y="590">+60%</text>
|
||||
<text class="nj-charts-tick" x="355" y="608">compile time compared with 3.12.0, less is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 13 KiB |
@@ -0,0 +1,60 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--swar" viewBox="0 0 640 312" role="img" aria-labelledby="nj-blog-swar nj-blog-swar-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-swar">Finding the end of a run of ordinary string characters eight bytes at a time</title>
|
||||
<desc id="nj-blog-swar-d">The eight bytes w, i, t, t, e, r, quote and comma are loaded as one word. The test sets the high bit only in byte 6, the quote. Counting trailing zero bits gives 55, divided by eight gives 6: bytes 0 to 5 are copied at once, then the quote ends the string.</desc>
|
||||
<text class="fg-h" x="40" y="20">eight input bytes, loaded as one 64-bit word (byte 0 is the lowest)</text>
|
||||
<rect class="fg-cell" x="40" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="72" y="60" text-anchor="middle">w</text>
|
||||
<text class="nj-charts-tick" x="72" y="92">0x77</text>
|
||||
<text class="nj-charts-tick" x="72" y="108">byte 0</text>
|
||||
<rect class="fg-cell" x="110" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="142" y="60" text-anchor="middle">i</text>
|
||||
<text class="nj-charts-tick" x="142" y="92">0x69</text>
|
||||
<text class="nj-charts-tick" x="142" y="108">byte 1</text>
|
||||
<rect class="fg-cell" x="180" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="212" y="60" text-anchor="middle">t</text>
|
||||
<text class="nj-charts-tick" x="212" y="92">0x74</text>
|
||||
<text class="nj-charts-tick" x="212" y="108">byte 2</text>
|
||||
<rect class="fg-cell" x="250" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="282" y="60" text-anchor="middle">t</text>
|
||||
<text class="nj-charts-tick" x="282" y="92">0x74</text>
|
||||
<text class="nj-charts-tick" x="282" y="108">byte 3</text>
|
||||
<rect class="fg-cell" x="320" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="352" y="60" text-anchor="middle">e</text>
|
||||
<text class="nj-charts-tick" x="352" y="92">0x65</text>
|
||||
<text class="nj-charts-tick" x="352" y="108">byte 4</text>
|
||||
<rect class="fg-cell" x="390" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="422" y="60" text-anchor="middle">r</text>
|
||||
<text class="nj-charts-tick" x="422" y="92">0x72</text>
|
||||
<text class="nj-charts-tick" x="422" y="108">byte 5</text>
|
||||
<rect class="fg-cell" x="460" y="34" width="64" height="40" rx="4"/>
|
||||
<rect class="nj-charts-c2" fill-opacity=".25" x="460" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="492" y="60" text-anchor="middle">"</text>
|
||||
<text class="nj-charts-tick" x="492" y="92">0x22</text>
|
||||
<text class="nj-charts-tick" x="492" y="108">byte 6</text>
|
||||
<rect class="fg-cell" x="530" y="34" width="64" height="40" rx="4"/>
|
||||
<text class="fg-code" x="562" y="60" text-anchor="middle">,</text>
|
||||
<text class="nj-charts-tick" x="562" y="92">0x2C</text>
|
||||
<text class="nj-charts-tick" x="562" y="108">byte 7</text>
|
||||
<text class="fg-h" x="40" y="132">swar_string_special(): the high bit of each byte that needs handling</text>
|
||||
<rect class="fg-cell" x="40" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="72" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="110" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="142" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="180" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="212" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="250" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="282" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="320" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="352" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="390" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="422" y="169" text-anchor="middle">0x00</text>
|
||||
<rect class="fg-cell" x="460" y="146" width="64" height="34" rx="4"/>
|
||||
<rect class="nj-charts-c2" fill-opacity=".25" x="460" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="492" y="169" text-anchor="middle">0x80</text>
|
||||
<rect class="fg-cell" x="530" y="146" width="64" height="34" rx="4"/>
|
||||
<text class="fg-code" x="562" y="169" text-anchor="middle">0x00</text>
|
||||
<text class="fg-code" x="40" y="216">count_trailing_zeros(0x0080000000000000) = 55</text>
|
||||
<text class="fg-code" x="40" y="242">55 / 8 = 6: copy bytes 0 to 5 in one go, then handle the quote</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="272">No branch per byte: a few subtractions, ANDs and ORs per word,</text>
|
||||
<text class="fg-note fg-note--l" x="40" y="290">then one count of trailing zeros.</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,45 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-accept_twitter nj-blog-tl-accept_twitter-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-accept_twitter">accept() twitter.json: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-accept_twitter-d">accept() twitter.json: speedup over 3.12.0 at each of 353 commits, ending at 5.1x. Labeled steps, by theme: 4, 1, 4, 4, 2, 2.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">accept() twitter.json</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="160.667" x2="330" y2="160.667"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="164.667">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="113.333" x2="330" y2="113.333"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="117.333">4×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">8×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.1 45.6,208.1 45.6,207.8 46.4,207.8 46.4,208.0 47.2,208.0 47.2,207.7 48.1,207.7 48.1,207.9 48.9,207.9 48.9,208.0 49.7,208.0 49.7,208.1 50.5,208.1 50.5,208.4 51.3,208.4 51.3,207.1 52.1,207.1 52.1,207.9 52.9,207.9 52.9,208.2 53.8,208.2 53.8,207.9 54.6,207.9 54.6,207.9 55.4,207.9 55.4,207.7 56.2,207.7 56.2,207.9 57.0,207.9 57.0,207.8 57.8,207.8 57.8,207.7 58.6,207.7 58.6,208.2 59.4,208.2 59.4,207.3 60.2,207.3 60.2,208.0 61.1,208.0 61.1,208.0 61.9,208.0 61.9,207.8 62.7,207.8 62.7,207.9 63.5,207.9 63.5,207.9 64.3,207.9 64.3,207.2 65.1,207.2 65.1,207.8 65.9,207.8 65.9,207.6 66.8,207.6 66.8,207.8 67.6,207.8 67.6,207.9 68.4,207.9 68.4,207.9 69.2,207.9 69.2,207.4 70.0,207.4 70.0,207.7 70.8,207.7 70.8,207.6 71.6,207.6 71.6,207.7 72.4,207.7 72.4,208.1 73.2,208.1 73.2,207.8 74.1,207.8 74.1,207.1 74.9,207.1 74.9,207.9 75.7,207.9 75.7,207.1 76.5,207.1 76.5,207.8 77.3,207.8 77.3,207.3 78.1,207.3 78.1,208.1 78.9,208.1 78.9,207.6 79.8,207.6 79.8,207.6 80.6,207.6 80.6,208.1 81.4,208.1 81.4,208.3 82.2,208.3 82.2,207.8 83.0,207.8 83.0,207.7 83.8,207.7 83.8,207.9 84.6,207.9 84.6,207.8 85.4,207.8 85.4,207.5 86.2,207.5 86.2,207.9 87.1,207.9 87.1,207.8 87.9,207.8 87.9,208.0 88.7,208.0 88.7,194.6 89.5,194.6 89.5,195.3 90.3,195.3 90.3,195.6 91.1,195.6 91.1,195.1 91.9,195.1 91.9,195.6 92.8,195.6 92.8,194.6 93.6,194.6 93.6,194.7 94.4,194.7 94.4,195.3 95.2,195.3 95.2,195.1 96.0,195.1 96.0,195.1 96.8,195.1 96.8,195.6 97.6,195.6 97.6,194.6 98.4,194.6 98.4,195.2 99.2,195.2 99.2,195.3 100.1,195.3 100.1,195.6 100.9,195.6 100.9,195.3 101.7,195.3 101.7,195.4 102.5,195.4 102.5,195.2 103.3,195.2 103.3,195.8 104.1,195.8 104.1,195.1 104.9,195.1 104.9,195.3 105.8,195.3 105.8,196.2 106.6,196.2 106.6,195.7 107.4,195.7 107.4,194.5 108.2,194.5 108.2,194.7 109.0,194.7 109.0,195.1 109.8,195.1 109.8,195.6 110.6,195.6 110.6,195.6 111.4,195.6 111.4,195.5 112.2,195.5 112.2,194.6 113.1,194.6 113.1,194.4 113.9,194.4 113.9,195.1 114.7,195.1 114.7,195.4 115.5,195.4 115.5,195.8 116.3,195.8 116.3,194.6 117.1,194.6 117.1,195.0 117.9,195.0 117.9,195.4 118.8,195.4 118.8,195.1 119.6,195.1 119.6,195.5 120.4,195.5 120.4,193.5 121.2,193.5 121.2,194.9 122.0,194.9 122.0,195.1 122.8,195.1 122.8,194.8 123.6,194.8 123.6,194.6 124.4,194.6 124.4,194.7 125.3,194.7 125.3,195.1 126.1,195.1 126.1,195.0 126.9,195.0 126.9,194.7 127.7,194.7 127.7,195.3 128.5,195.3 128.5,194.6 129.3,194.6 129.3,194.7 130.1,194.7 130.1,143.3 130.9,143.3 130.9,143.0 131.8,143.0 131.8,142.2 132.6,142.2 132.6,141.9 133.4,141.9 133.4,143.0 134.2,143.0 134.2,142.6 135.0,142.6 135.0,142.4 135.8,142.4 135.8,142.9 136.6,142.9 136.6,143.1 137.4,143.1 137.4,143.2 138.2,143.2 138.2,142.1 139.1,142.1 139.1,143.1 139.9,143.1 139.9,142.4 140.7,142.4 140.7,143.0 141.5,143.0 141.5,141.8 142.3,141.8 142.3,143.1 143.1,143.1 143.1,141.9 143.9,141.9 143.9,143.1 144.8,143.1 144.8,142.9 145.6,142.9 145.6,142.0 146.4,142.0 146.4,142.5 147.2,142.5 147.2,142.4 148.0,142.4 148.0,143.5 148.8,143.5 148.8,142.9 149.6,142.9 149.6,142.3 150.4,142.3 150.4,143.1 151.2,143.1 151.2,141.9 152.1,141.9 152.1,142.4 152.9,142.4 152.9,141.9 153.7,141.9 153.7,141.8 154.5,141.8 154.5,141.3 155.3,141.3 155.3,142.9 156.1,142.9 156.1,141.2 156.9,141.2 156.9,142.8 157.8,142.8 157.8,142.6 158.6,142.6 158.6,142.3 159.4,142.3 159.4,142.7 160.2,142.7 160.2,142.0 161.0,142.0 161.0,141.5 161.8,141.5 161.8,141.2 162.6,141.2 162.6,141.4 163.4,141.4 163.4,141.9 164.2,141.9 164.2,141.6 165.1,141.6 165.1,141.8 165.9,141.8 165.9,142.0 166.7,142.0 166.7,142.0 167.5,142.0 167.5,141.5 168.3,141.5 168.3,142.4 169.1,142.4 169.1,141.7 169.9,141.7 169.9,142.4 170.8,142.4 170.8,141.9 171.6,141.9 171.6,141.7 172.4,141.7 172.4,141.1 173.2,141.1 173.2,141.5 174.0,141.5 174.0,141.6 174.8,141.6 174.8,141.7 175.6,141.7 175.6,140.3 176.4,140.3 176.4,140.7 177.2,140.7 177.2,140.6 178.1,140.6 178.1,141.0 178.9,141.0 178.9,141.8 179.7,141.8 179.7,141.6 180.5,141.6 180.5,141.5 181.3,141.5 181.3,141.0 182.1,141.0 182.1,141.1 182.9,141.1 182.9,140.7 183.8,140.7 183.8,140.4 184.6,140.4 184.6,142.1 185.4,142.1 185.4,141.7 186.2,141.7 186.2,141.2 187.0,141.2 187.0,141.5 187.8,141.5 187.8,140.4 188.6,140.4 188.6,141.0 189.4,141.0 189.4,141.5 190.2,141.5 190.2,141.2 191.1,141.2 191.1,142.1 191.9,142.1 191.9,140.4 192.7,140.4 192.7,141.1 193.5,141.1 193.5,141.5 194.3,141.5 194.3,140.9 195.1,140.9 195.1,141.7 195.9,141.7 195.9,140.4 196.8,140.4 196.8,141.9 197.6,141.9 197.6,141.1 198.4,141.1 198.4,141.4 199.2,141.4 199.2,140.6 200.0,140.6 200.0,141.4 200.8,141.4 200.8,140.1 201.6,140.1 201.6,141.2 202.4,141.2 202.4,140.8 203.2,140.8 203.2,141.4 204.1,141.4 204.1,141.5 204.9,141.5 204.9,141.2 205.7,141.2 205.7,142.0 206.5,142.0 206.5,142.6 207.3,142.6 207.3,142.3 208.1,142.3 208.1,140.6 208.9,140.6 208.9,140.8 209.8,140.8 209.8,140.9 210.6,140.9 210.6,141.1 211.4,141.1 211.4,141.6 212.2,141.6 212.2,141.0 213.0,141.0 213.0,141.5 213.8,141.5 213.8,141.4 214.6,141.4 214.6,142.0 215.4,142.0 215.4,140.6 216.2,140.6 216.2,1Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="88.7" cy="194.6" r="3.5"><title>#5234: 1.22×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="88.7" y1="54.0" x2="88.7" y2="189.6"/>
|
||||
<circle class="nj-theme-dot" cx="88.7" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="88.7" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="130.1" cy="143.3" r="3.5"><title>#5283: 2.6×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="130.1" y1="54.0" x2="130.1" y2="138.3"/>
|
||||
<circle class="nj-theme-dot" cx="130.1" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="130.1" y="50.0" text-anchor="middle">1</text>
|
||||
<circle class="nj-charts-json-dot" cx="222.8" cy="135.2" r="3.5"><title>#5592: 2.9×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="222.8" y1="54.0" x2="222.8" y2="130.2"/>
|
||||
<circle class="nj-theme-dot" cx="222.8" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="222.8" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="243.1" cy="118.7" r="3.5"><title>#5809: 3.7×</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="243.9" cy="112.7" r="3.5"><title>#5810: 4.0×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="243.9" y1="36.0" x2="243.9" y2="107.7"/>
|
||||
<circle class="nj-theme-dot" cx="234.9" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="234.9" y="32.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-theme-dot" cx="252.9" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="252.9" y="32.0" text-anchor="middle">2</text>
|
||||
<circle class="nj-charts-json-dot" cx="273.1" cy="99.2" r="3.5"><title>#5853: 4.9×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="273.1" y1="54.0" x2="273.1" y2="94.2"/>
|
||||
<circle class="nj-theme-dot" cx="273.1" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="273.1" y="50.0" text-anchor="middle">2</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,30 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-dump_canada nj-blog-tl-dump_canada-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-dump_canada">dump() canada.json: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-dump_canada-d">dump() canada.json: speedup over 3.12.0 at each of 353 commits, ending at 3.3x. Labeled steps, by theme: 6, 3.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">dump() canada.json</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="160.667" x2="330" y2="160.667"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="164.667">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="113.333" x2="330" y2="113.333"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="117.333">4×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">8×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.0 45.6,208.0 45.6,207.2 46.4,207.2 46.4,207.9 47.2,207.9 47.2,206.7 48.1,206.7 48.1,207.5 48.9,207.5 48.9,207.7 49.7,207.7 49.7,207.3 50.5,207.3 50.5,207.9 51.3,207.9 51.3,206.6 52.1,206.6 52.1,207.5 52.9,207.5 52.9,208.0 53.8,208.0 53.8,207.6 54.6,207.6 54.6,207.2 55.4,207.2 55.4,207.5 56.2,207.5 56.2,206.6 57.0,206.6 57.0,207.1 57.8,207.1 57.8,207.1 58.6,207.1 58.6,207.2 59.4,207.2 59.4,206.6 60.2,206.6 60.2,207.5 61.1,207.5 61.1,207.6 61.9,207.6 61.9,207.7 62.7,207.7 62.7,207.2 63.5,207.2 63.5,206.5 64.3,206.5 64.3,206.8 65.1,206.8 65.1,207.1 65.9,207.1 65.9,207.0 66.8,207.0 66.8,207.1 67.6,207.1 67.6,206.7 68.4,206.7 68.4,208.2 69.2,208.2 69.2,207.5 70.0,207.5 70.0,206.6 70.8,206.6 70.8,206.7 71.6,206.7 71.6,206.3 72.4,206.3 72.4,208.4 73.2,208.4 73.2,207.3 74.1,207.3 74.1,206.8 74.9,206.8 74.9,208.0 75.7,208.0 75.7,207.8 76.5,207.8 76.5,207.1 77.3,207.1 77.3,207.5 78.1,207.5 78.1,207.9 78.9,207.9 78.9,206.3 79.8,206.3 79.8,206.8 80.6,206.8 80.6,207.5 81.4,207.5 81.4,208.1 82.2,208.1 82.2,206.6 83.0,206.6 83.0,207.2 83.8,207.2 83.8,207.2 84.6,207.2 84.6,207.4 85.4,207.4 85.4,207.0 86.2,207.0 86.2,206.7 87.1,206.7 87.1,206.5 87.9,206.5 87.9,207.6 88.7,207.6 88.7,207.4 89.5,207.4 89.5,207.2 90.3,207.2 90.3,207.5 91.1,207.5 91.1,207.6 91.9,207.6 91.9,208.0 92.8,208.0 92.8,208.2 93.6,208.2 93.6,206.7 94.4,206.7 94.4,207.4 95.2,207.4 95.2,206.7 96.0,206.7 96.0,206.6 96.8,206.6 96.8,208.0 97.6,208.0 97.6,208.0 98.4,208.0 98.4,206.3 99.2,206.3 99.2,208.3 100.1,208.3 100.1,207.8 100.9,207.8 100.9,207.4 101.7,207.4 101.7,206.3 102.5,206.3 102.5,208.1 103.3,208.1 103.3,207.5 104.1,207.5 104.1,207.4 104.9,207.4 104.9,207.5 105.8,207.5 105.8,207.7 106.6,207.7 106.6,208.0 107.4,208.0 107.4,207.0 108.2,207.0 108.2,207.5 109.0,207.5 109.0,207.2 109.8,207.2 109.8,207.7 110.6,207.7 110.6,207.3 111.4,207.3 111.4,208.0 112.2,208.0 112.2,206.7 113.1,206.7 113.1,206.6 113.9,206.6 113.9,207.2 114.7,207.2 114.7,208.1 115.5,208.1 115.5,208.1 116.3,208.1 116.3,206.7 117.1,206.7 117.1,207.8 117.9,207.8 117.9,207.6 118.8,207.6 118.8,207.4 119.6,207.4 119.6,207.1 120.4,207.1 120.4,207.5 121.2,207.5 121.2,208.8 122.0,208.8 122.0,209.2 122.8,209.2 122.8,208.4 123.6,208.4 123.6,208.3 124.4,208.3 124.4,208.0 125.3,208.0 125.3,209.0 126.1,209.0 126.1,208.5 126.9,208.5 126.9,209.1 127.7,209.1 127.7,209.2 128.5,209.2 128.5,208.6 129.3,208.6 129.3,207.7 130.1,207.7 130.1,207.7 130.9,207.7 130.9,207.5 131.8,207.5 131.8,202.2 132.6,202.2 132.6,202.3 133.4,202.3 133.4,201.7 134.2,201.7 134.2,202.3 135.0,202.3 135.0,201.9 135.8,201.9 135.8,201.2 136.6,201.2 136.6,202.1 137.4,202.1 137.4,202.6 138.2,202.6 138.2,201.5 139.1,201.5 139.1,202.3 139.9,202.3 139.9,202.3 140.7,202.3 140.7,201.7 141.5,201.7 141.5,201.3 142.3,201.3 142.3,202.5 143.1,202.5 143.1,201.1 143.9,201.1 143.9,202.9 144.8,202.9 144.8,202.2 145.6,202.2 145.6,201.7 146.4,201.7 146.4,201.7 147.2,201.7 147.2,201.6 148.0,201.6 148.0,203.0 148.8,203.0 148.8,202.7 149.6,202.7 149.6,202.4 150.4,202.4 150.4,202.8 151.2,202.8 151.2,202.1 152.1,202.1 152.1,203.1 152.9,203.1 152.9,202.3 153.7,202.3 153.7,202.3 154.5,202.3 154.5,201.8 155.3,201.8 155.3,203.1 156.1,203.1 156.1,201.8 156.9,201.8 156.9,202.6 157.8,202.6 157.8,202.6 158.6,202.6 158.6,202.9 159.4,202.9 159.4,202.3 160.2,202.3 160.2,202.3 161.0,202.3 161.0,201.6 161.8,201.6 161.8,201.5 162.6,201.5 162.6,202.4 163.4,202.4 163.4,201.7 164.2,201.7 164.2,201.2 165.1,201.2 165.1,202.2 165.9,202.2 165.9,201.6 166.7,201.6 166.7,201.6 167.5,201.6 167.5,201.8 168.3,201.8 168.3,202.1 169.1,202.1 169.1,201.7 169.9,201.7 169.9,201.4 170.8,201.4 170.8,202.2 171.6,202.2 171.6,202.7 172.4,202.7 172.4,202.4 173.2,202.4 173.2,201.7 174.0,201.7 174.0,201.7 174.8,201.7 174.8,202.3 175.6,202.3 175.6,201.6 176.4,201.6 176.4,201.7 177.2,201.7 177.2,202.2 178.1,202.2 178.1,202.2 178.9,202.2 178.9,202.4 179.7,202.4 179.7,201.7 180.5,201.7 180.5,202.1 181.3,202.1 181.3,201.6 182.1,201.6 182.1,202.2 182.9,202.2 182.9,201.9 183.8,201.9 183.8,201.9 184.6,201.9 184.6,202.5 185.4,202.5 185.4,201.6 186.2,201.6 186.2,202.1 187.0,202.1 187.0,202.3 187.8,202.3 187.8,201.8 188.6,201.8 188.6,201.5 189.4,201.5 189.4,202.3 190.2,202.3 190.2,202.2 191.1,202.2 191.1,202.9 191.9,202.9 191.9,201.3 192.7,201.3 192.7,202.2 193.5,202.2 193.5,203.6 194.3,203.6 194.3,201.9 195.1,201.9 195.1,202.4 195.9,202.4 195.9,201.7 196.8,201.7 196.8,202.7 197.6,202.7 197.6,202.3 198.4,202.3 198.4,202.5 199.2,202.5 199.2,202.1 200.0,202.1 200.0,203.4 200.8,203.4 200.8,202.1 201.6,202.1 201.6,202.3 202.4,202.3 202.4,201.9 203.2,201.9 203.2,202.3 204.1,202.3 204.1,201.7 204.9,201.7 204.9,202.4 205.7,202.4 205.7,202.3 206.5,202.3 206.5,202.9 207.3,202.9 207.3,202.9 208.1,202.9 208.1,202.2 208.9,202.2 208.9,202.4 209.8,202.4 209.8,202.2 210.6,202.2 210.6,202.7 211.4,202.7 211.4,202.5 212.2,202.5 212.2,202.5 213.0,202.5 213.0,201.5 213.8,201.5 213.8,203.1 214.6,203.1 214.6,203.2 215.4,203.2 215.4,201.5 216.2,201.5 216.2,2Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="131.8" cy="202.2" r="3.5"><title>#5285: 1.09×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="131.8" y1="54.0" x2="131.8" y2="197.2"/>
|
||||
<circle class="nj-theme-dot" cx="131.8" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="131.8" y="50.0" text-anchor="middle">6</text>
|
||||
<circle class="nj-charts-json-dot" cx="246.3" cy="130.7" r="3.5"><title>#5634: 3.1×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="246.3" y1="54.0" x2="246.3" y2="125.7"/>
|
||||
<circle class="nj-theme-dot" cx="246.3" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="246.3" y="50.0" text-anchor="middle">3</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,37 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-dump_twitter nj-blog-tl-dump_twitter-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-dump_twitter">dump() twitter.json: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-dump_twitter-d">dump() twitter.json: speedup over 3.12.0 at each of 353 commits, ending at 6.8x. Labeled steps, by theme: 6, 2, 2, 2.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">dump() twitter.json</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="172.5" x2="330" y2="172.5"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="176.5">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="137" x2="330" y2="137"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="141">4×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="101.5" x2="330" y2="101.5"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="105.5">8×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">16×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.0 45.6,208.0 45.6,207.2 46.4,207.2 46.4,207.9 47.2,207.9 47.2,206.8 48.1,206.8 48.1,208.0 48.9,208.0 48.9,207.4 49.7,207.4 49.7,207.3 50.5,207.3 50.5,208.0 51.3,208.0 51.3,206.8 52.1,206.8 52.1,207.2 52.9,207.2 52.9,208.0 53.8,208.0 53.8,207.2 54.6,207.2 54.6,207.5 55.4,207.5 55.4,206.8 56.2,206.8 56.2,206.9 57.0,206.9 57.0,207.5 57.8,207.5 57.8,207.3 58.6,207.3 58.6,207.8 59.4,207.8 59.4,206.8 60.2,206.8 60.2,207.8 61.1,207.8 61.1,207.4 61.9,207.4 61.9,208.0 62.7,208.0 62.7,207.4 63.5,207.4 63.5,207.3 64.3,207.3 64.3,206.9 65.1,206.9 65.1,207.3 65.9,207.3 65.9,207.4 66.8,207.4 66.8,207.6 67.6,207.6 67.6,207.5 68.4,207.5 68.4,207.6 69.2,207.6 69.2,207.4 70.0,207.4 70.0,207.2 70.8,207.2 70.8,207.1 71.6,207.1 71.6,207.3 72.4,207.3 72.4,207.7 73.2,207.7 73.2,207.8 74.1,207.8 74.1,206.9 74.9,206.9 74.9,207.6 75.7,207.6 75.7,207.0 76.5,207.0 76.5,207.0 77.3,207.0 77.3,207.3 78.1,207.3 78.1,207.6 78.9,207.6 78.9,206.8 79.8,206.8 79.8,207.7 80.6,207.7 80.6,207.4 81.4,207.4 81.4,207.5 82.2,207.5 82.2,207.1 83.0,207.1 83.0,207.3 83.8,207.3 83.8,207.5 84.6,207.5 84.6,207.3 85.4,207.3 85.4,207.3 86.2,207.3 86.2,206.9 87.1,206.9 87.1,207.4 87.9,207.4 87.9,207.9 88.7,207.9 88.7,207.3 89.5,207.3 89.5,206.8 90.3,206.8 90.3,207.6 91.1,207.6 91.1,207.7 91.9,207.7 91.9,208.6 92.8,208.6 92.8,208.5 93.6,208.5 93.6,208.6 94.4,208.6 94.4,209.2 95.2,209.2 95.2,208.5 96.0,208.5 96.0,208.2 96.8,208.2 96.8,209.3 97.6,209.3 97.6,208.4 98.4,208.4 98.4,208.4 99.2,208.4 99.2,209.0 100.1,209.0 100.1,209.0 100.9,209.0 100.9,208.7 101.7,208.7 101.7,208.9 102.5,208.9 102.5,208.7 103.3,208.7 103.3,209.0 104.1,209.0 104.1,208.8 104.9,208.8 104.9,208.7 105.8,208.7 105.8,209.3 106.6,209.3 106.6,208.6 107.4,208.6 107.4,208.5 108.2,208.5 108.2,208.4 109.0,208.4 109.0,208.0 109.8,208.0 109.8,208.9 110.6,208.9 110.6,208.6 111.4,208.6 111.4,208.9 112.2,208.9 112.2,208.1 113.1,208.1 113.1,208.0 113.9,208.0 113.9,208.6 114.7,208.6 114.7,208.5 115.5,208.5 115.5,209.1 116.3,209.1 116.3,208.0 117.1,208.0 117.1,209.1 117.9,209.1 117.9,208.9 118.8,208.9 118.8,208.5 119.6,208.5 119.6,209.1 120.4,209.1 120.4,209.0 121.2,209.0 121.2,208.8 122.0,208.8 122.0,208.6 122.8,208.6 122.8,208.6 123.6,208.6 123.6,208.2 124.4,208.2 124.4,209.0 125.3,209.0 125.3,209.2 126.1,209.2 126.1,209.1 126.9,209.1 126.9,209.2 127.7,209.2 127.7,209.2 128.5,209.2 128.5,208.5 129.3,208.5 129.3,208.7 130.1,208.7 130.1,209.5 130.9,209.5 130.9,208.4 131.8,208.4 131.8,147.4 132.6,147.4 132.6,148.3 133.4,148.3 133.4,148.4 134.2,148.4 134.2,147.5 135.0,147.5 135.0,147.5 135.8,147.5 135.8,147.7 136.6,147.7 136.6,148.2 137.4,148.2 137.4,148.2 138.2,148.2 138.2,147.3 139.1,147.3 139.1,148.1 139.9,148.1 139.9,147.2 140.7,147.2 140.7,147.5 141.5,147.5 141.5,147.3 142.3,147.3 142.3,148.4 143.1,148.4 143.1,147.4 143.9,147.4 143.9,148.3 144.8,148.3 144.8,148.5 145.6,148.5 145.6,147.7 146.4,147.7 146.4,147.8 147.2,147.8 147.2,148.0 148.0,148.0 148.0,148.5 148.8,148.5 148.8,148.0 149.6,148.0 149.6,148.1 150.4,148.1 150.4,148.2 151.2,148.2 151.2,148.3 152.1,148.3 152.1,149.0 152.9,149.0 152.9,148.7 153.7,148.7 153.7,148.2 154.5,148.2 154.5,148.1 155.3,148.1 155.3,148.9 156.1,148.9 156.1,147.7 156.9,147.7 156.9,149.2 157.8,149.2 157.8,149.1 158.6,149.1 158.6,148.8 159.4,148.8 159.4,148.1 160.2,148.1 160.2,148.7 161.0,148.7 161.0,147.7 161.8,147.7 161.8,147.9 162.6,147.9 162.6,147.7 163.4,147.7 163.4,148.3 164.2,148.3 164.2,148.0 165.1,148.0 165.1,148.2 165.9,148.2 165.9,148.4 166.7,148.4 166.7,148.3 167.5,148.3 167.5,148.1 168.3,148.1 168.3,149.0 169.1,149.0 169.1,147.8 169.9,147.8 169.9,148.8 170.8,148.8 170.8,148.3 171.6,148.3 171.6,148.0 172.4,148.0 172.4,147.8 173.2,147.8 173.2,148.0 174.0,148.0 174.0,147.7 174.8,147.7 174.8,148.2 175.6,148.2 175.6,147.1 176.4,147.1 176.4,147.9 177.2,147.9 177.2,147.9 178.1,147.9 178.1,147.9 178.9,147.9 178.9,147.7 179.7,147.7 179.7,148.0 180.5,148.0 180.5,147.4 181.3,147.4 181.3,147.5 182.1,147.5 182.1,147.5 182.9,147.5 182.9,147.0 183.8,147.0 183.8,147.0 184.6,147.0 184.6,148.2 185.4,148.2 185.4,147.7 186.2,147.7 186.2,148.0 187.0,148.0 187.0,148.2 187.8,148.2 187.8,147.7 188.6,147.7 188.6,147.8 189.4,147.8 189.4,148.2 190.2,148.2 190.2,148.3 191.1,148.3 191.1,148.5 191.9,148.5 191.9,148.1 192.7,148.1 192.7,147.9 193.5,147.9 193.5,148.2 194.3,148.2 194.3,147.5 195.1,147.5 195.1,148.1 195.9,148.1 195.9,147.6 196.8,147.6 196.8,148.4 197.6,148.4 197.6,148.2 198.4,148.2 198.4,148.3 199.2,148.3 199.2,148.7 200.0,148.7 200.0,149.4 200.8,149.4 200.8,148.7 201.6,148.7 201.6,149.5 202.4,149.5 202.4,148.2 203.2,148.2 203.2,148.5 204.1,148.5 204.1,149.1 204.9,149.1 204.9,148.8 205.7,148.8 205.7,149.2 206.5,149.2 206.5,149.3 207.3,149.3 207.3,149.1 208.1,149.1 208.1,148.6 208.9,148.6 208.9,148.9 209.8,148.9 209.8,148.5 210.6,148.5 210.6,148.9 211.4,148.9 211.4,149.0 212.2,149.0 212.2,149.0 213.0,149.0 213.0,148.5 213.8,148.5 213.8,149.1 214.6,149.1 214.6,149.2 215.4,149.2 215.4,148.3 216.2,148.3 216.2,1Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="131.8" cy="147.4" r="3.5"><title>#5285: 3.3×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="131.8" y1="54.0" x2="131.8" y2="142.4"/>
|
||||
<circle class="nj-theme-dot" cx="131.8" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="131.8" y="50.0" text-anchor="middle">6</text>
|
||||
<circle class="nj-charts-json-dot" cx="245.5" cy="139.0" r="3.5"><title>#5738: 3.8×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="245.5" y1="54.0" x2="245.5" y2="134.0"/>
|
||||
<circle class="nj-theme-dot" cx="245.5" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="245.5" y="50.0" text-anchor="middle">2</text>
|
||||
<circle class="nj-charts-json-dot" cx="275.6" cy="131.0" r="3.5"><title>#5878: 4.5×</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="281.2" cy="109.6" r="3.5"><title>#5883: 6.8×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="281.2" y1="54.0" x2="281.2" y2="104.6"/>
|
||||
<circle class="nj-theme-dot" cx="281.2" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="281.2" y="50.0" text-anchor="middle">2</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,36 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-from_cbor_twitter nj-blog-tl-from_cbor_twitter-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-from_cbor_twitter">from_cbor() twitter: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-from_cbor_twitter-d">from_cbor() twitter: speedup over 3.12.0 at each of 353 commits, ending at 2.6x. Labeled steps, by theme: 1, 4, U, U.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">from_cbor() twitter</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="137" x2="330" y2="137"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="141">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">4×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,209.1 45.6,209.1 45.6,208.2 46.4,208.2 46.4,208.6 47.2,208.6 47.2,208.0 48.1,208.0 48.1,208.4 48.9,208.4 48.9,208.6 49.7,208.6 49.7,208.3 50.5,208.3 50.5,209.1 51.3,209.1 51.3,207.8 52.1,207.8 52.1,208.5 52.9,208.5 52.9,208.6 53.8,208.6 53.8,208.6 54.6,208.6 54.6,207.7 55.4,207.7 55.4,207.1 56.2,207.1 56.2,207.3 57.0,207.3 57.0,206.9 57.8,206.9 57.8,207.1 58.6,207.1 58.6,207.0 59.4,207.0 59.4,207.1 60.2,207.1 60.2,207.1 61.1,207.1 61.1,207.5 61.9,207.5 61.9,207.5 62.7,207.5 62.7,206.9 63.5,206.9 63.5,207.0 64.3,207.0 64.3,206.2 65.1,206.2 65.1,207.1 65.9,207.1 65.9,208.5 66.8,208.5 66.8,208.0 67.6,208.0 67.6,207.8 68.4,207.8 68.4,208.5 69.2,208.5 69.2,207.8 70.0,207.8 70.0,207.0 70.8,207.0 70.8,208.1 71.6,208.1 71.6,208.2 72.4,208.2 72.4,208.6 73.2,208.6 73.2,208.1 74.1,208.1 74.1,207.2 74.9,207.2 74.9,208.3 75.7,208.3 75.7,207.4 76.5,207.4 76.5,207.9 77.3,207.9 77.3,207.7 78.1,207.7 78.1,208.6 78.9,208.6 78.9,207.3 79.8,207.3 79.8,207.9 80.6,207.9 80.6,208.4 81.4,208.4 81.4,208.5 82.2,208.5 82.2,208.0 83.0,208.0 83.0,207.1 83.8,207.1 83.8,208.1 84.6,208.1 84.6,208.1 85.4,208.1 85.4,207.8 86.2,207.8 86.2,207.9 87.1,207.9 87.1,207.9 87.9,207.9 87.9,208.7 88.7,208.7 88.7,208.1 89.5,208.1 89.5,168.9 90.3,168.9 90.3,170.3 91.1,170.3 91.1,169.9 91.9,169.9 91.9,169.0 92.8,169.0 92.8,169.6 93.6,169.6 93.6,169.1 94.4,169.1 94.4,170.1 95.2,170.1 95.2,168.8 96.0,168.8 96.0,167.9 96.8,167.9 96.8,170.4 97.6,170.4 97.6,169.5 98.4,169.5 98.4,169.7 99.2,169.7 99.2,172.9 100.1,172.9 100.1,170.5 100.9,170.5 100.9,170.4 101.7,170.4 101.7,170.1 102.5,170.1 102.5,170.2 103.3,170.2 103.3,170.7 104.1,170.7 104.1,170.5 104.9,170.5 104.9,170.4 105.8,170.4 105.8,171.1 106.6,171.1 106.6,170.2 107.4,170.2 107.4,168.6 108.2,168.6 108.2,168.9 109.0,168.9 109.0,168.8 109.8,168.8 109.8,170.5 110.6,170.5 110.6,169.2 111.4,169.2 111.4,169.8 112.2,169.8 112.2,168.2 113.1,168.2 113.1,168.3 113.9,168.3 113.9,169.9 114.7,169.9 114.7,170.3 115.5,170.3 115.5,170.5 116.3,170.5 116.3,169.2 117.1,169.2 117.1,170.5 117.9,170.5 117.9,170.1 118.8,170.1 118.8,170.0 119.6,170.0 119.6,170.0 120.4,170.0 120.4,169.7 121.2,169.7 121.2,169.9 122.0,169.9 122.0,169.2 122.8,169.2 122.8,169.6 123.6,169.6 123.6,170.0 124.4,170.0 124.4,170.0 125.3,170.0 125.3,170.5 126.1,170.5 126.1,170.8 126.9,170.8 126.9,170.5 127.7,170.5 127.7,170.8 128.5,170.8 128.5,169.2 129.3,169.2 129.3,128.6 130.1,128.6 130.1,121.0 130.9,121.0 130.9,120.5 131.8,120.5 131.8,120.8 132.6,120.8 132.6,120.9 133.4,120.9 133.4,120.2 134.2,120.2 134.2,116.5 135.0,116.5 135.0,117.5 135.8,117.5 135.8,117.4 136.6,117.4 136.6,118.0 137.4,118.0 137.4,118.3 138.2,118.3 138.2,118.0 139.1,118.0 139.1,120.1 139.9,120.1 139.9,118.9 140.7,118.9 140.7,119.6 141.5,119.6 141.5,119.0 142.3,119.0 142.3,120.9 143.1,120.9 143.1,118.6 143.9,118.6 143.9,121.1 144.8,121.1 144.8,120.1 145.6,120.1 145.6,118.4 146.4,118.4 146.4,119.3 147.2,119.3 147.2,119.0 148.0,119.0 148.0,120.2 148.8,120.2 148.8,119.0 149.6,119.0 149.6,119.4 150.4,119.4 150.4,119.8 151.2,119.8 151.2,120.4 152.1,120.4 152.1,120.6 152.9,120.6 152.9,119.6 153.7,119.6 153.7,118.8 154.5,118.8 154.5,118.4 155.3,118.4 155.3,120.2 156.1,120.2 156.1,119.3 156.9,119.3 156.9,119.9 157.8,119.9 157.8,119.6 158.6,119.6 158.6,119.7 159.4,119.7 159.4,119.2 160.2,119.2 160.2,119.5 161.0,119.5 161.0,118.0 161.8,118.0 161.8,150.3 162.6,150.3 162.6,150.5 163.4,150.5 163.4,150.6 164.2,150.6 164.2,151.3 165.1,151.3 165.1,151.4 165.9,151.4 165.9,150.7 166.7,150.7 166.7,152.1 167.5,152.1 167.5,151.8 168.3,151.8 168.3,152.4 169.1,152.4 169.1,150.6 169.9,150.6 169.9,152.8 170.8,152.8 170.8,154.2 171.6,154.2 171.6,152.8 172.4,152.8 172.4,152.9 173.2,152.9 173.2,153.6 174.0,153.6 174.0,151.7 174.8,151.7 174.8,153.8 175.6,153.8 175.6,151.6 176.4,151.6 176.4,152.6 177.2,152.6 177.2,153.5 178.1,153.5 178.1,151.8 178.9,151.8 178.9,152.7 179.7,152.7 179.7,153.6 180.5,153.6 180.5,152.7 181.3,152.7 181.3,152.5 182.1,152.5 182.1,152.7 182.9,152.7 182.9,151.6 183.8,151.6 183.8,153.2 184.6,153.2 184.6,154.6 185.4,154.6 185.4,152.1 186.2,152.1 186.2,152.9 187.0,152.9 187.0,153.9 187.8,153.9 187.8,153.0 188.6,153.0 188.6,152.6 189.4,152.6 189.4,154.0 190.2,154.0 190.2,154.0 191.1,154.0 191.1,154.3 191.9,154.3 191.9,152.5 192.7,152.5 192.7,154.4 193.5,154.4 193.5,154.2 194.3,154.2 194.3,151.8 195.1,151.8 195.1,154.0 195.9,154.0 195.9,153.0 196.8,153.0 196.8,152.2 197.6,152.2 197.6,153.7 198.4,153.7 198.4,153.8 199.2,153.8 199.2,153.9 200.0,153.9 200.0,155.5 200.8,155.5 200.8,153.4 201.6,153.4 201.6,155.4 202.4,155.4 202.4,152.8 203.2,152.8 203.2,154.0 204.1,154.0 204.1,152.3 204.9,152.3 204.9,153.2 205.7,153.2 205.7,153.5 206.5,153.5 206.5,153.6 207.3,153.6 207.3,154.6 208.1,154.6 208.1,152.7 208.9,152.7 208.9,155.4 209.8,155.4 209.8,152.5 210.6,152.5 210.6,153.3 211.4,153.3 211.4,153.3 212.2,153.3 212.2,154.5 213.0,154.5 213.0,152.6 213.8,152.6 213.8,153.0 214.6,153.0 214.6,154.3 215.4,154.3 215.4,122.0 216.2,122.0 216.2,1Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="89.5" cy="168.9" r="3.5"><title>#5233: 1.47×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="89.5" y1="54.0" x2="89.5" y2="163.9"/>
|
||||
<circle class="nj-theme-dot" cx="89.5" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="89.5" y="50.0" text-anchor="middle">1</text>
|
||||
<circle class="nj-charts-json-dot" cx="129.3" cy="128.6" r="3.5"><title>#5501: 2.2×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="129.3" y1="54.0" x2="129.3" y2="123.6"/>
|
||||
<circle class="nj-theme-dot" cx="129.3" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="129.3" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="161.8" cy="150.3" r="3.5"><title>#5185: 1.76×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="161.8" y1="54.0" x2="161.8" y2="145.3"/>
|
||||
<circle class="nj-theme-dot nj-theme-dot--other" cx="161.8" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="161.8" y="50.0" text-anchor="middle">U</text>
|
||||
<circle class="nj-charts-json-dot" cx="215.4" cy="122.0" r="3.5"><title>#5746: 2.3×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="215.4" y1="54.0" x2="215.4" y2="117.0"/>
|
||||
<circle class="nj-theme-dot nj-theme-dot--other" cx="215.4" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="215.4" y="50.0" text-anchor="middle">U</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,44 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-parse_canada nj-blog-tl-parse_canada-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-parse_canada">parse() canada.json: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-parse_canada-d">parse() canada.json: speedup over 3.12.0 at each of 353 commits, ending at 2.8x. Labeled steps, by theme: 4, 1, 3, 3, 3, 4.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">parse() canada.json</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="137" x2="330" y2="137"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="141">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">4×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.2 45.6,208.2 45.6,208.1 46.4,208.1 46.4,207.7 47.2,207.7 47.2,207.2 48.1,207.2 48.1,208.0 48.9,208.0 48.9,208.2 49.7,208.2 49.7,207.8 50.5,207.8 50.5,208.5 51.3,208.5 51.3,207.3 52.1,207.3 52.1,208.0 52.9,208.0 52.9,209.1 53.8,209.1 53.8,208.5 54.6,208.5 54.6,208.1 55.4,208.1 55.4,207.7 56.2,207.7 56.2,209.8 57.0,209.8 57.0,208.6 57.8,208.6 57.8,208.1 58.6,208.1 58.6,208.1 59.4,208.1 59.4,207.0 60.2,207.0 60.2,207.8 61.1,207.8 61.1,207.6 61.9,207.6 61.9,208.1 62.7,208.1 62.7,208.4 63.5,208.4 63.5,207.8 64.3,207.8 64.3,207.4 65.1,207.4 65.1,208.3 65.9,208.3 65.9,207.3 66.8,207.3 66.8,207.8 67.6,207.8 67.6,207.9 68.4,207.9 68.4,207.9 69.2,207.9 69.2,207.5 70.0,207.5 70.0,207.5 70.8,207.5 70.8,208.1 71.6,208.1 71.6,208.1 72.4,208.1 72.4,207.9 73.2,207.9 73.2,207.8 74.1,207.8 74.1,207.1 74.9,207.1 74.9,207.6 75.7,207.6 75.7,207.8 76.5,207.8 76.5,207.3 77.3,207.3 77.3,207.6 78.1,207.6 78.1,208.6 78.9,208.6 78.9,206.5 79.8,206.5 79.8,208.0 80.6,208.0 80.6,208.7 81.4,208.7 81.4,208.0 82.2,208.0 82.2,207.7 83.0,207.7 83.0,208.4 83.8,208.4 83.8,207.9 84.6,207.9 84.6,207.5 85.4,207.5 85.4,207.9 86.2,207.9 86.2,207.4 87.1,207.4 87.1,207.5 87.9,207.5 87.9,208.5 88.7,208.5 88.7,197.5 89.5,197.5 89.5,197.9 90.3,197.9 90.3,196.9 91.1,196.9 91.1,197.0 91.9,197.0 91.9,197.7 92.8,197.7 92.8,196.0 93.6,196.0 93.6,197.3 94.4,197.3 94.4,198.1 95.2,198.1 95.2,197.4 96.0,197.4 96.0,197.0 96.8,197.0 96.8,197.5 97.6,197.5 97.6,197.3 98.4,197.3 98.4,197.7 99.2,197.7 99.2,197.7 100.1,197.7 100.1,197.6 100.9,197.6 100.9,196.9 101.7,196.9 101.7,197.9 102.5,197.9 102.5,197.9 103.3,197.9 103.3,197.6 104.1,197.6 104.1,197.6 104.9,197.6 104.9,197.6 105.8,197.6 105.8,198.1 106.6,198.1 106.6,198.0 107.4,198.0 107.4,195.3 108.2,195.3 108.2,196.6 109.0,196.6 109.0,197.9 109.8,197.9 109.8,197.0 110.6,197.0 110.6,196.3 111.4,196.3 111.4,196.8 112.2,196.8 112.2,196.6 113.1,196.6 113.1,196.6 113.9,196.6 113.9,197.7 114.7,197.7 114.7,197.5 115.5,197.5 115.5,198.1 116.3,198.1 116.3,195.9 117.1,195.9 117.1,197.5 117.9,197.5 117.9,197.6 118.8,197.6 118.8,196.7 119.6,196.7 119.6,197.0 120.4,197.0 120.4,198.0 121.2,198.0 121.2,197.0 122.0,197.0 122.0,197.2 122.8,197.2 122.8,196.6 123.6,196.6 123.6,197.0 124.4,197.0 124.4,197.2 125.3,197.2 125.3,197.6 126.1,197.6 126.1,197.8 126.9,197.8 126.9,197.2 127.7,197.2 127.7,197.6 128.5,197.6 128.5,197.3 129.3,197.3 129.3,197.0 130.1,197.0 130.1,168.6 130.9,168.6 130.9,169.7 131.8,169.7 131.8,170.1 132.6,170.1 132.6,168.9 133.4,168.9 133.4,168.3 134.2,168.3 134.2,169.9 135.0,169.9 135.0,168.7 135.8,168.7 135.8,168.3 136.6,168.3 136.6,169.7 137.4,169.7 137.4,170.9 138.2,170.9 138.2,168.1 139.1,168.1 139.1,170.2 139.9,170.2 139.9,169.1 140.7,169.1 140.7,170.1 141.5,170.1 141.5,168.5 142.3,168.5 142.3,169.7 143.1,169.7 143.1,170.1 143.9,170.1 143.9,169.8 144.8,169.8 144.8,169.1 145.6,169.1 145.6,167.2 146.4,167.2 146.4,169.7 147.2,169.7 147.2,168.6 148.0,168.6 148.0,170.3 148.8,170.3 148.8,169.7 149.6,169.7 149.6,168.7 150.4,168.7 150.4,169.3 151.2,169.3 151.2,172.3 152.1,172.3 152.1,171.2 152.9,171.2 152.9,169.1 153.7,169.1 153.7,167.8 154.5,167.8 154.5,169.3 155.3,169.3 155.3,169.1 156.1,169.1 156.1,168.5 156.9,168.5 156.9,168.7 157.8,168.7 157.8,168.6 158.6,168.6 158.6,169.0 159.4,169.0 159.4,168.5 160.2,168.5 160.2,170.9 161.0,170.9 161.0,169.9 161.8,169.9 161.8,168.0 162.6,168.0 162.6,168.8 163.4,168.8 163.4,168.5 164.2,168.5 164.2,168.5 165.1,168.5 165.1,169.9 165.9,169.9 165.9,169.1 166.7,169.1 166.7,168.6 167.5,168.6 167.5,168.6 168.3,168.6 168.3,169.4 169.1,169.4 169.1,169.1 169.9,169.1 169.9,170.2 170.8,170.2 170.8,178.0 171.6,178.0 171.6,177.3 172.4,177.3 172.4,167.7 173.2,167.7 173.2,168.5 174.0,168.5 174.0,168.7 174.8,168.7 174.8,168.5 175.6,168.5 175.6,168.8 176.4,168.8 176.4,168.0 177.2,168.0 177.2,168.2 178.1,168.2 178.1,167.7 178.9,167.7 178.9,167.5 179.7,167.5 179.7,168.1 180.5,168.1 180.5,168.3 181.3,168.3 181.3,168.1 182.1,168.1 182.1,168.1 182.9,168.1 182.9,167.5 183.8,167.5 183.8,166.5 184.6,166.5 184.6,169.1 185.4,169.1 185.4,168.6 186.2,168.6 186.2,168.5 187.0,168.5 187.0,168.1 187.8,168.1 187.8,167.3 188.6,167.3 188.6,168.0 189.4,168.0 189.4,168.3 190.2,168.3 190.2,168.6 191.1,168.6 191.1,169.0 191.9,169.0 191.9,166.6 192.7,166.6 192.7,169.4 193.5,169.4 193.5,169.3 194.3,169.3 194.3,167.3 195.1,167.3 195.1,168.5 195.9,168.5 195.9,167.1 196.8,167.1 196.8,169.4 197.6,169.4 197.6,168.9 198.4,168.9 198.4,167.4 199.2,167.4 199.2,168.4 200.0,168.4 200.0,168.5 200.8,168.5 200.8,166.9 201.6,166.9 201.6,168.7 202.4,168.7 202.4,165.7 203.2,165.7 203.2,167.0 204.1,167.0 204.1,166.6 204.9,166.6 204.9,167.4 205.7,167.4 205.7,167.6 206.5,167.6 206.5,167.2 207.3,167.2 207.3,167.4 208.1,167.4 208.1,166.6 208.9,166.6 208.9,166.2 209.8,166.2 209.8,168.4 210.6,168.4 210.6,167.2 211.4,167.2 211.4,166.7 212.2,166.7 212.2,166.5 213.0,166.5 213.0,166.0 213.8,166.0 213.8,167.4 214.6,167.4 214.6,167.3 215.4,167.3 215.4,167.3 216.2,167.3 216.2,1Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="88.7" cy="197.5" r="3.5"><title>#5234: 1.11×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="88.7" y1="54.0" x2="88.7" y2="192.5"/>
|
||||
<circle class="nj-theme-dot" cx="88.7" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="88.7" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="130.1" cy="168.6" r="3.5"><title>#5283: 1.47×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="130.1" y1="54.0" x2="130.1" y2="163.6"/>
|
||||
<circle class="nj-theme-dot" cx="130.1" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="130.1" y="50.0" text-anchor="middle">1</text>
|
||||
<circle class="nj-charts-json-dot" cx="172.4" cy="167.7" r="3.5"><title>#5617: 1.48×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="172.4" y1="54.0" x2="172.4" y2="162.7"/>
|
||||
<circle class="nj-theme-dot" cx="172.4" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="172.4" y="50.0" text-anchor="middle">3</text>
|
||||
<circle class="nj-charts-json-dot" cx="245.5" cy="139.8" r="3.5"><title>#5738: 1.95×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="245.5" y1="54.0" x2="245.5" y2="134.8"/>
|
||||
<circle class="nj-theme-dot" cx="245.5" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="245.5" y="50.0" text-anchor="middle">3</text>
|
||||
<circle class="nj-charts-json-dot" cx="271.5" cy="127.4" r="3.5"><title>#5851: 2.2×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="271.5" y1="54.0" x2="271.5" y2="122.4"/>
|
||||
<circle class="nj-theme-dot" cx="271.5" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="271.5" y="50.0" text-anchor="middle">3</text>
|
||||
<circle class="nj-charts-json-dot" cx="285.3" cy="102.2" r="3.5"><title>#5882: 2.8×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="285.3" y1="36.0" x2="285.3" y2="97.2"/>
|
||||
<circle class="nj-theme-dot" cx="285.3" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="285.3" y="32.0" text-anchor="middle">4</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,45 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-parse_citm nj-blog-tl-parse_citm-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-parse_citm">parse() citm_catalog.json: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-parse_citm-d">parse() citm_catalog.json: speedup over 3.12.0 at each of 353 commits, ending at 3.3x. Labeled steps, by theme: 4, 1, 4, 4, 2, 4.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">parse() citm_catalog.json</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="160.667" x2="330" y2="160.667"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="164.667">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="113.333" x2="330" y2="113.333"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="117.333">4×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">8×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.2 45.6,208.2 45.6,207.8 46.4,207.8 46.4,207.5 47.2,207.5 47.2,206.5 48.1,206.5 48.1,208.3 48.9,208.3 48.9,207.3 49.7,207.3 49.7,206.8 50.5,206.8 50.5,207.8 51.3,207.8 51.3,206.8 52.1,206.8 52.1,207.3 52.9,207.3 52.9,207.6 53.8,207.6 53.8,207.8 54.6,207.8 54.6,207.0 55.4,207.0 55.4,207.3 56.2,207.3 56.2,207.2 57.0,207.2 57.0,207.4 57.8,207.4 57.8,207.5 58.6,207.5 58.6,207.4 59.4,207.4 59.4,206.6 60.2,206.6 60.2,207.6 61.1,207.6 61.1,207.6 61.9,207.6 61.9,207.2 62.7,207.2 62.7,207.0 63.5,207.0 63.5,207.6 64.3,207.6 64.3,206.7 65.1,206.7 65.1,207.4 65.9,207.4 65.9,206.8 66.8,206.8 66.8,207.3 67.6,207.3 67.6,207.7 68.4,207.7 68.4,207.9 69.2,207.9 69.2,207.2 70.0,207.2 70.0,206.4 70.8,206.4 70.8,207.6 71.6,207.6 71.6,206.4 72.4,206.4 72.4,208.0 73.2,208.0 73.2,207.4 74.1,207.4 74.1,206.5 74.9,206.5 74.9,207.5 75.7,207.5 75.7,207.2 76.5,207.2 76.5,206.9 77.3,206.9 77.3,207.6 78.1,207.6 78.1,207.6 78.9,207.6 78.9,207.0 79.8,207.0 79.8,206.9 80.6,206.9 80.6,208.0 81.4,208.0 81.4,207.6 82.2,207.6 82.2,206.6 83.0,206.6 83.0,206.8 83.8,206.8 83.8,207.3 84.6,207.3 84.6,206.9 85.4,206.9 85.4,207.6 86.2,207.6 86.2,207.1 87.1,207.1 87.1,207.6 87.9,207.6 87.9,207.9 88.7,207.9 88.7,178.2 89.5,178.2 89.5,177.5 90.3,177.5 90.3,177.7 91.1,177.7 91.1,177.6 91.9,177.6 91.9,177.7 92.8,177.7 92.8,177.1 93.6,177.1 93.6,176.8 94.4,176.8 94.4,177.7 95.2,177.7 95.2,177.6 96.0,177.6 96.0,176.8 96.8,176.8 96.8,177.8 97.6,177.8 97.6,177.0 98.4,177.0 98.4,176.8 99.2,176.8 99.2,178.0 100.1,178.0 100.1,178.1 100.9,178.1 100.9,177.6 101.7,177.6 101.7,177.6 102.5,177.6 102.5,177.4 103.3,177.4 103.3,177.6 104.1,177.6 104.1,177.8 104.9,177.8 104.9,177.5 105.8,177.5 105.8,177.9 106.6,177.9 106.6,177.7 107.4,177.7 107.4,175.9 108.2,175.9 108.2,177.5 109.0,177.5 109.0,177.6 109.8,177.6 109.8,177.6 110.6,177.6 110.6,176.9 111.4,176.9 111.4,177.5 112.2,177.5 112.2,177.4 113.1,177.4 113.1,177.4 113.9,177.4 113.9,176.9 114.7,176.9 114.7,177.9 115.5,177.9 115.5,177.3 116.3,177.3 116.3,176.6 117.1,176.6 117.1,177.4 117.9,177.4 117.9,177.5 118.8,177.5 118.8,177.5 119.6,177.5 119.6,177.4 120.4,177.4 120.4,177.0 121.2,177.0 121.2,177.7 122.0,177.7 122.0,176.2 122.8,176.2 122.8,176.9 123.6,176.9 123.6,177.5 124.4,177.5 124.4,177.8 125.3,177.8 125.3,177.8 126.1,177.8 126.1,177.9 126.9,177.9 126.9,177.3 127.7,177.3 127.7,177.5 128.5,177.5 128.5,177.4 129.3,177.4 129.3,177.1 130.1,177.1 130.1,162.5 130.9,162.5 130.9,162.2 131.8,162.2 131.8,161.8 132.6,161.8 132.6,162.2 133.4,162.2 133.4,161.2 134.2,161.2 134.2,160.7 135.0,160.7 135.0,159.4 135.8,159.4 135.8,160.3 136.6,160.3 136.6,160.4 137.4,160.4 137.4,160.6 138.2,160.6 138.2,159.5 139.1,159.5 139.1,160.4 139.9,160.4 139.9,159.6 140.7,159.6 140.7,160.0 141.5,160.0 141.5,159.9 142.3,159.9 142.3,160.2 143.1,160.2 143.1,159.6 143.9,159.6 143.9,160.8 144.8,160.8 144.8,160.1 145.6,160.1 145.6,159.1 146.4,159.1 146.4,159.7 147.2,159.7 147.2,159.9 148.0,159.9 148.0,160.5 148.8,160.5 148.8,160.2 149.6,160.2 149.6,159.9 150.4,159.9 150.4,160.5 151.2,160.5 151.2,160.5 152.1,160.5 152.1,160.6 152.9,160.6 152.9,159.7 153.7,159.7 153.7,159.5 154.5,159.5 154.5,160.0 155.3,160.0 155.3,160.2 156.1,160.2 156.1,160.0 156.9,160.0 156.9,160.6 157.8,160.6 157.8,159.9 158.6,159.9 158.6,160.2 159.4,160.2 159.4,160.1 160.2,160.1 160.2,160.8 161.0,160.8 161.0,159.2 161.8,159.2 161.8,159.6 162.6,159.6 162.6,159.2 163.4,159.2 163.4,160.0 164.2,160.0 164.2,159.4 165.1,159.4 165.1,159.6 165.9,159.6 165.9,159.5 166.7,159.5 166.7,160.1 167.5,160.1 167.5,159.0 168.3,159.0 168.3,159.4 169.1,159.4 169.1,160.2 169.9,160.2 169.9,161.4 170.8,161.4 170.8,161.7 171.6,161.7 171.6,161.6 172.4,161.6 172.4,160.3 173.2,160.3 173.2,161.1 174.0,161.1 174.0,161.2 174.8,161.2 174.8,161.7 175.6,161.7 175.6,161.2 176.4,161.2 176.4,160.4 177.2,160.4 177.2,161.6 178.1,161.6 178.1,160.6 178.9,160.6 178.9,161.4 179.7,161.4 179.7,161.3 180.5,161.3 180.5,161.3 181.3,161.3 181.3,161.7 182.1,161.7 182.1,161.2 182.9,161.2 182.9,160.1 183.8,160.1 183.8,160.9 184.6,160.9 184.6,161.5 185.4,161.5 185.4,160.6 186.2,160.6 186.2,161.9 187.0,161.9 187.0,161.4 187.8,161.4 187.8,160.1 188.6,160.1 188.6,160.6 189.4,160.6 189.4,162.0 190.2,162.0 190.2,161.5 191.1,161.5 191.1,162.0 191.9,162.0 191.9,161.3 192.7,161.3 192.7,162.3 193.5,162.3 193.5,162.1 194.3,162.1 194.3,160.8 195.1,160.8 195.1,161.5 195.9,161.5 195.9,161.4 196.8,161.4 196.8,162.2 197.6,162.2 197.6,161.4 198.4,161.4 198.4,161.4 199.2,161.4 199.2,161.8 200.0,161.8 200.0,160.7 200.8,160.7 200.8,160.5 201.6,160.5 201.6,160.5 202.4,160.5 202.4,159.3 203.2,159.3 203.2,159.4 204.1,159.4 204.1,160.4 204.9,160.4 204.9,160.1 205.7,160.1 205.7,160.4 206.5,160.4 206.5,160.4 207.3,160.4 207.3,160.8 208.1,160.8 208.1,159.8 208.9,159.8 208.9,159.4 209.8,159.4 209.8,160.5 210.6,160.5 210.6,160.1 211.4,160.1 211.4,160.7 212.2,160.7 212.2,160.6 213.0,160.6 213.0,159.5 213.8,159.5 213.8,161.1 214.6,161.1 214.6,161.3 215.4,161.3 215.4,161.0 216.2,161.0 216.2,1Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="88.7" cy="178.2" r="3.5"><title>#5234: 1.55×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="88.7" y1="54.0" x2="88.7" y2="173.2"/>
|
||||
<circle class="nj-theme-dot" cx="88.7" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="88.7" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="130.1" cy="162.5" r="3.5"><title>#5283: 1.95×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="130.1" y1="54.0" x2="130.1" y2="157.5"/>
|
||||
<circle class="nj-theme-dot" cx="130.1" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="130.1" y="50.0" text-anchor="middle">1</text>
|
||||
<circle class="nj-charts-json-dot" cx="222.8" cy="155.4" r="3.5"><title>#5592: 2.2×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="222.8" y1="54.0" x2="222.8" y2="150.4"/>
|
||||
<circle class="nj-theme-dot" cx="222.8" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="222.8" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="243.1" cy="147.1" r="3.5"><title>#5809: 2.4×</title></circle>
|
||||
<circle class="nj-charts-json-dot" cx="243.9" cy="138.2" r="3.5"><title>#5810: 2.8×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="243.9" y1="36.0" x2="243.9" y2="133.2"/>
|
||||
<circle class="nj-theme-dot" cx="234.9" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="234.9" y="32.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-theme-dot" cx="252.9" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="252.9" y="32.0" text-anchor="middle">2</text>
|
||||
<circle class="nj-charts-json-dot" cx="285.3" cy="125.7" r="3.5"><title>#5882: 3.3×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="285.3" y1="54.0" x2="285.3" y2="120.7"/>
|
||||
<circle class="nj-theme-dot" cx="285.3" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="285.3" y="50.0" text-anchor="middle">4</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -0,0 +1,28 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-parse_twitter_ifstream nj-blog-tl-parse_twitter_ifstream-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-parse_twitter_ifstream">parse() twitter.json, std::ifstream: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-parse_twitter_ifstream-d">parse() twitter.json, std::ifstream: speedup over 3.12.0 at each of 353 commits, ending at 2.2x. Labeled steps, by theme: 1, 1.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">parse() twitter.json, std::ifstream</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="137" x2="330" y2="137"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="141">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">4×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,209.3 45.6,209.3 45.6,206.6 46.4,206.6 46.4,208.3 47.2,208.3 47.2,205.9 48.1,205.9 48.1,209.3 48.9,209.3 48.9,208.3 49.7,208.3 49.7,207.9 50.5,207.9 50.5,209.4 51.3,209.4 51.3,205.8 52.1,205.8 52.1,206.7 52.9,206.7 52.9,209.2 53.8,209.2 53.8,208.1 54.6,208.1 54.6,206.9 55.4,206.9 55.4,207.5 56.2,207.5 56.2,207.5 57.0,207.5 57.0,207.6 57.8,207.6 57.8,206.9 58.6,206.9 58.6,206.9 59.4,206.9 59.4,208.4 60.2,208.4 60.2,208.6 61.1,208.6 61.1,209.1 61.9,209.1 61.9,207.7 62.7,207.7 62.7,207.0 63.5,207.0 63.5,206.7 64.3,206.7 64.3,206.1 65.1,206.1 65.1,207.5 65.9,207.5 65.9,206.4 66.8,206.4 66.8,206.7 67.6,206.7 67.6,206.8 68.4,206.8 68.4,209.3 69.2,209.3 69.2,206.7 70.0,206.7 70.0,206.8 70.8,206.8 70.8,206.6 71.6,206.6 71.6,206.8 72.4,206.8 72.4,209.2 73.2,209.2 73.2,207.6 74.1,207.6 74.1,205.9 74.9,205.9 74.9,209.1 75.7,209.1 75.7,206.6 76.5,206.6 76.5,207.4 77.3,207.4 77.3,207.0 78.1,207.0 78.1,209.1 78.9,209.1 78.9,205.8 79.8,205.8 79.8,206.9 80.6,206.9 80.6,208.0 81.4,208.0 81.4,208.5 82.2,208.5 82.2,206.6 83.0,206.6 83.0,206.0 83.8,206.0 83.8,207.9 84.6,207.9 84.6,206.6 85.4,206.6 85.4,206.5 86.2,206.5 86.2,206.6 87.1,206.6 87.1,207.2 87.9,207.2 87.9,208.0 88.7,208.0 88.7,208.1 89.5,208.1 89.5,206.7 90.3,206.7 90.3,207.8 91.1,207.8 91.1,206.7 91.9,206.7 91.9,208.1 92.8,208.1 92.8,205.9 93.6,205.9 93.6,206.8 94.4,206.8 94.4,208.0 95.2,208.0 95.2,207.3 96.0,207.3 96.0,206.7 96.8,206.7 96.8,209.3 97.6,209.3 97.6,206.5 98.4,206.5 98.4,207.2 99.2,207.2 99.2,208.2 100.1,208.2 100.1,209.3 100.9,209.3 100.9,207.8 101.7,207.8 101.7,206.9 102.5,206.9 102.5,206.7 103.3,206.7 103.3,209.0 104.1,209.0 104.1,208.0 104.9,208.0 104.9,208.1 105.8,208.1 105.8,209.1 106.6,209.1 106.6,208.1 107.4,208.1 107.4,205.6 108.2,205.6 108.2,207.0 109.0,207.0 109.0,206.7 109.8,206.7 109.8,207.9 110.6,207.9 110.6,206.7 111.4,206.7 111.4,206.9 112.2,206.9 112.2,206.8 113.1,206.8 113.1,206.4 113.9,206.4 113.9,207.1 114.7,207.1 114.7,208.6 115.5,208.6 115.5,208.7 116.3,208.7 116.3,206.6 117.1,206.6 117.1,209.3 117.9,209.3 117.9,208.0 118.8,208.0 118.8,206.7 119.6,206.7 119.6,207.7 120.4,207.7 120.4,206.9 121.2,206.9 121.2,208.8 122.0,208.8 122.0,208.7 122.8,208.7 122.8,207.7 123.6,207.7 123.6,208.8 124.4,208.8 124.4,207.8 125.3,207.8 125.3,210.3 126.1,210.3 126.1,208.9 126.9,208.9 126.9,208.9 127.7,208.9 127.7,209.0 128.5,209.0 128.5,208.0 129.3,208.0 129.3,207.7 130.1,207.7 130.1,208.3 130.9,208.3 130.9,207.0 131.8,207.0 131.8,207.2 132.6,207.2 132.6,207.5 133.4,207.5 133.4,208.0 134.2,208.0 134.2,207.6 135.0,207.6 135.0,207.9 135.8,207.9 135.8,207.6 136.6,207.6 136.6,208.5 137.4,208.5 137.4,209.2 138.2,209.2 138.2,206.3 139.1,206.3 139.1,208.7 139.9,208.7 139.9,207.6 140.7,207.6 140.7,207.4 141.5,207.4 141.5,207.5 142.3,207.5 142.3,209.0 143.1,209.0 143.1,206.9 143.9,206.9 143.9,209.3 144.8,209.3 144.8,209.9 145.6,209.9 145.6,207.0 146.4,207.0 146.4,207.3 147.2,207.3 147.2,208.1 148.0,208.1 148.0,209.8 148.8,209.8 148.8,208.1 149.6,208.1 149.6,208.1 150.4,208.1 150.4,208.5 151.2,208.5 151.2,208.2 152.1,208.2 152.1,210.4 152.9,210.4 152.9,207.7 153.7,207.7 153.7,207.2 154.5,207.2 154.5,206.7 155.3,206.7 155.3,209.9 156.1,209.9 156.1,206.6 156.9,206.6 156.9,209.9 157.8,209.9 157.8,208.8 158.6,208.8 158.6,208.8 159.4,208.8 159.4,209.5 160.2,209.5 160.2,208.9 161.0,208.9 161.0,206.4 161.8,206.4 161.8,207.2 162.6,207.2 162.6,207.0 163.4,207.0 163.4,207.2 164.2,207.2 164.2,206.6 165.1,206.6 165.1,207.2 165.9,207.2 165.9,208.0 166.7,208.0 166.7,207.6 167.5,207.6 167.5,207.9 168.3,207.9 168.3,207.5 169.1,207.5 169.1,205.6 169.9,205.6 169.9,208.0 170.8,208.0 170.8,209.7 171.6,209.7 171.6,207.9 172.4,207.9 172.4,207.6 173.2,207.6 173.2,208.5 174.0,208.5 174.0,207.9 174.8,207.9 174.8,210.4 175.6,210.4 175.6,206.7 176.4,206.7 176.4,207.7 177.2,207.7 177.2,209.2 178.1,209.2 178.1,206.8 178.9,206.8 178.9,209.3 179.7,209.3 179.7,208.0 180.5,208.0 180.5,208.0 181.3,208.0 181.3,207.9 182.1,207.9 182.1,208.2 182.9,208.2 182.9,207.9 183.8,207.9 183.8,207.0 184.6,207.0 184.6,208.8 185.4,208.8 185.4,208.0 186.2,208.0 186.2,208.0 187.0,208.0 187.0,209.2 187.8,209.2 187.8,206.7 188.6,206.7 188.6,206.7 189.4,206.7 189.4,208.5 190.2,208.5 190.2,208.9 191.1,208.9 191.1,210.1 191.9,210.1 191.9,206.4 192.7,206.4 192.7,209.4 193.5,209.4 193.5,210.1 194.3,210.1 194.3,207.6 195.1,207.6 195.1,209.5 195.9,209.5 195.9,208.7 196.8,208.7 196.8,211.1 197.6,211.1 197.6,210.1 198.4,210.1 198.4,211.7 199.2,211.7 199.2,208.8 200.0,208.8 200.0,209.2 200.8,209.2 200.8,207.7 201.6,207.7 201.6,208.1 202.4,208.1 202.4,206.4 203.2,206.4 203.2,206.7 204.1,206.7 204.1,207.3 204.9,207.3 204.9,207.8 205.7,207.8 205.7,208.7 206.5,208.7 206.5,210.1 207.3,210.1 207.3,210.0 208.1,210.0 208.1,206.9 208.9,206.9 208.9,209.0 209.8,209.0 209.8,208.7 210.6,208.7 210.6,209.1 211.4,209.1 211.4,208.6 212.2,208.6 212.2,208.9 213.0,208.9 213.0,207.3 213.8,207.3 213.8,208.9 214.6,208.9 214.6,209.2 215.4,209.2 215.4,207.3 216.2,207.3 216.2,2Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="262.6" cy="138.8" r="3.5"><title>#5828: 1.97×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="262.6" y1="54.0" x2="262.6" y2="133.8"/>
|
||||
<circle class="nj-theme-dot" cx="262.6" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="262.6" y="50.0" text-anchor="middle">1</text>
|
||||
<circle class="nj-charts-json-dot" cx="279.6" cy="127.0" r="3.5"><title>#5884: 2.2×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="279.6" y1="36.0" x2="279.6" y2="122.0"/>
|
||||
<circle class="nj-theme-dot" cx="279.6" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="279.6" y="32.0" text-anchor="middle">1</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,34 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--timeline" viewBox="0 0 340 270" role="img" aria-labelledby="nj-blog-tl-to_cbor_twitter nj-blog-tl-to_cbor_twitter-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-tl-to_cbor_twitter">to_cbor() twitter: speedup over 3.12.0 by commit</title>
|
||||
<desc id="nj-blog-tl-to_cbor_twitter-d">to_cbor() twitter: speedup over 3.12.0 at each of 353 commits, ending at 5.0x. Labeled steps, by theme: 4, 6, 6.</desc>
|
||||
<text class="nj-charts-panel" x="8" y="18">to_cbor() twitter</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="212">1×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="160.667" x2="330" y2="160.667"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="164.667">2×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="113.333" x2="330" y2="113.333"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="117.333">4×</text>
|
||||
<line class="nj-charts-grid" x1="44" y1="66" x2="330" y2="66"/>
|
||||
<text class="nj-charts-tick nj-charts-tick--r" x="38" y="70">8×</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="44" y2="212"/>
|
||||
<text class="nj-charts-tick" x="44" y="225">3.12.0</text>
|
||||
<line class="nj-charts-axis" x1="117.938" y1="208" x2="117.938" y2="212"/>
|
||||
<text class="nj-charts-tick" x="117.938" y="225">Sep 2026</text>
|
||||
<line class="nj-charts-axis" x1="198.375" y1="208" x2="198.375" y2="212"/>
|
||||
<text class="nj-charts-tick" x="198.375" y="225">Oct</text>
|
||||
<polyline class="nj-charts-json" points="44.0,208.0 44.8,208.0 44.8,208.0 45.6,208.0 45.6,204.9 46.4,204.9 46.4,205.2 47.2,205.2 47.2,204.7 48.1,204.7 48.1,205.2 48.9,205.2 48.9,205.0 49.7,205.0 49.7,204.9 50.5,204.9 50.5,205.0 51.3,205.0 51.3,205.0 52.1,205.0 52.1,205.1 52.9,205.1 52.9,205.4 53.8,205.4 53.8,205.0 54.6,205.0 54.6,205.2 55.4,205.2 55.4,211.6 56.2,211.6 56.2,206.8 57.0,206.8 57.0,204.2 57.8,204.2 57.8,207.6 58.6,207.6 58.6,204.1 59.4,204.1 59.4,203.8 60.2,203.8 60.2,204.2 61.1,204.2 61.1,205.1 61.9,205.1 61.9,204.4 62.7,204.4 62.7,204.3 63.5,204.3 63.5,204.0 64.3,204.0 64.3,202.7 65.1,202.7 65.1,204.2 65.9,204.2 65.9,204.2 66.8,204.2 66.8,204.2 67.6,204.2 67.6,204.4 68.4,204.4 68.4,206.2 69.2,206.2 69.2,204.3 70.0,204.3 70.0,204.1 70.8,204.1 70.8,204.3 71.6,204.3 71.6,204.3 72.4,204.3 72.4,204.3 73.2,204.3 73.2,204.3 74.1,204.3 74.1,204.4 74.9,204.4 74.9,204.8 75.7,204.8 75.7,208.4 76.5,208.4 76.5,203.5 77.3,203.5 77.3,206.2 78.1,206.2 78.1,204.4 78.9,204.4 78.9,203.2 79.8,203.2 79.8,204.1 80.6,204.1 80.6,204.2 81.4,204.2 81.4,203.7 82.2,203.7 82.2,204.2 83.0,204.2 83.0,203.2 83.8,203.2 83.8,204.2 84.6,204.2 84.6,204.4 85.4,204.4 85.4,203.8 86.2,203.8 86.2,204.4 87.1,204.4 87.1,204.7 87.9,204.7 87.9,204.6 88.7,204.6 88.7,208.7 89.5,208.7 89.5,205.2 90.3,205.2 90.3,205.5 91.1,205.5 91.1,205.2 91.9,205.2 91.9,205.3 92.8,205.3 92.8,206.8 93.6,206.8 93.6,204.6 94.4,204.6 94.4,205.5 95.2,205.5 95.2,205.1 96.0,205.1 96.0,204.7 96.8,204.7 96.8,205.7 97.6,205.7 97.6,205.0 98.4,205.0 98.4,204.9 99.2,204.9 99.2,206.5 100.1,206.5 100.1,205.6 100.9,205.6 100.9,205.0 101.7,205.0 101.7,209.2 102.5,209.2 102.5,205.9 103.3,205.9 103.3,206.5 104.1,206.5 104.1,205.5 104.9,205.5 104.9,205.3 105.8,205.3 105.8,205.3 106.6,205.3 106.6,205.1 107.4,205.1 107.4,204.4 108.2,204.4 108.2,204.6 109.0,204.6 109.0,204.8 109.8,204.8 109.8,204.2 110.6,204.2 110.6,203.8 111.4,203.8 111.4,204.4 112.2,204.4 112.2,202.8 113.1,202.8 113.1,203.5 113.9,203.5 113.9,204.0 114.7,204.0 114.7,204.3 115.5,204.3 115.5,202.9 116.3,202.9 116.3,203.3 117.1,203.3 117.1,204.4 117.9,204.4 117.9,204.5 118.8,204.5 118.8,204.1 119.6,204.1 119.6,208.3 120.4,208.3 120.4,203.8 121.2,203.8 121.2,207.0 122.0,207.0 122.0,205.9 122.8,205.9 122.8,205.4 123.6,205.4 123.6,205.3 124.4,205.3 124.4,205.8 125.3,205.8 125.3,205.4 126.1,205.4 126.1,205.6 126.9,205.6 126.9,206.3 127.7,206.3 127.7,205.5 128.5,205.5 128.5,204.8 129.3,204.8 129.3,204.6 130.1,204.6 130.1,206.1 130.9,206.1 130.9,204.6 131.8,204.6 131.8,204.1 132.6,204.1 132.6,204.3 133.4,204.3 133.4,205.6 134.2,205.6 134.2,203.9 135.0,203.9 135.0,204.0 135.8,204.0 135.8,203.9 136.6,203.9 136.6,204.6 137.4,204.6 137.4,204.1 138.2,204.1 138.2,203.9 139.1,203.9 139.1,204.8 139.9,204.8 139.9,203.2 140.7,203.2 140.7,203.3 141.5,203.3 141.5,204.7 142.3,204.7 142.3,208.3 143.1,208.3 143.1,204.3 143.9,204.3 143.9,207.4 144.8,207.4 144.8,204.4 145.6,204.4 145.6,208.2 146.4,208.2 146.4,205.0 147.2,205.0 147.2,204.9 148.0,204.9 148.0,208.8 148.8,208.8 148.8,207.9 149.6,207.9 149.6,206.2 150.4,206.2 150.4,204.2 151.2,204.2 151.2,204.1 152.1,204.1 152.1,204.2 152.9,204.2 152.9,202.2 153.7,202.2 153.7,205.6 154.5,205.6 154.5,203.0 155.3,203.0 155.3,203.4 156.1,203.4 156.1,202.7 156.9,202.7 156.9,203.6 157.8,203.6 157.8,203.3 158.6,203.3 158.6,203.2 159.4,203.2 159.4,204.9 160.2,204.9 160.2,202.9 161.0,202.9 161.0,202.2 161.8,202.2 161.8,202.5 162.6,202.5 162.6,202.9 163.4,202.9 163.4,202.9 164.2,202.9 164.2,202.3 165.1,202.3 165.1,202.9 165.9,202.9 165.9,203.7 166.7,203.7 166.7,204.1 167.5,204.1 167.5,203.9 168.3,203.9 168.3,203.7 169.1,203.7 169.1,203.3 169.9,203.3 169.9,203.8 170.8,203.8 170.8,205.0 171.6,205.0 171.6,208.0 172.4,208.0 172.4,205.1 173.2,205.1 173.2,206.5 174.0,206.5 174.0,205.4 174.8,205.4 174.8,205.4 175.6,205.4 175.6,207.0 176.4,207.0 176.4,204.9 177.2,204.9 177.2,205.4 178.1,205.4 178.1,203.6 178.9,203.6 178.9,205.7 179.7,205.7 179.7,204.5 180.5,204.5 180.5,205.0 181.3,205.0 181.3,205.2 182.1,205.2 182.1,204.9 182.9,204.9 182.9,204.5 183.8,204.5 183.8,204.9 184.6,204.9 184.6,205.3 185.4,205.3 185.4,203.9 186.2,203.9 186.2,204.8 187.0,204.8 187.0,204.8 187.8,204.8 187.8,203.6 188.6,203.6 188.6,203.4 189.4,203.4 189.4,203.8 190.2,203.8 190.2,205.1 191.1,205.1 191.1,205.5 191.9,205.5 191.9,204.0 192.7,204.0 192.7,204.9 193.5,204.9 193.5,205.0 194.3,205.0 194.3,206.4 195.1,206.4 195.1,205.1 195.9,205.1 195.9,204.5 196.8,204.5 196.8,204.8 197.6,204.8 197.6,205.2 198.4,205.2 198.4,205.0 199.2,205.0 199.2,204.6 200.0,204.6 200.0,203.9 200.8,203.9 200.8,203.5 201.6,203.5 201.6,203.6 202.4,203.6 202.4,204.2 203.2,204.2 203.2,205.9 204.1,205.9 204.1,205.2 204.9,205.2 204.9,204.8 205.7,204.8 205.7,207.3 206.5,207.3 206.5,205.2 207.3,205.2 207.3,208.6 208.1,208.6 208.1,204.3 208.9,204.3 208.9,203.9 209.8,203.9 209.8,203.2 210.6,203.2 210.6,203.9 211.4,203.9 211.4,205.9 212.2,205.9 212.2,204.8 213.0,204.8 213.0,204.7 213.8,204.7 213.8,203.6 214.6,203.6 214.6,203.7 215.4,203.7 215.4,208.2 216.2,208.2 216.2,2Line truncated
|
||||
<circle class="nj-charts-json-dot" cx="234.9" cy="153.7" r="3.5"><title>#5328: 2.2×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="234.9" y1="54.0" x2="234.9" y2="148.7"/>
|
||||
<circle class="nj-theme-dot" cx="234.9" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="234.9" y="50.0" text-anchor="middle">4</text>
|
||||
<circle class="nj-charts-json-dot" cx="269.9" cy="123.4" r="3.5"><title>#5824: 3.5×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="269.9" y1="54.0" x2="269.9" y2="118.4"/>
|
||||
<circle class="nj-theme-dot" cx="269.9" cy="46.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="269.9" y="50.0" text-anchor="middle">6</text>
|
||||
<circle class="nj-charts-json-dot" cx="282.1" cy="96.9" r="3.5"><title>#5885: 5.1×</title></circle>
|
||||
<line class="nj-charts-grid" stroke-dasharray="2 2" x1="282.1" y1="36.0" x2="282.1" y2="91.9"/>
|
||||
<circle class="nj-theme-dot" cx="282.1" cy="28.0" r="7.5"/>
|
||||
<text class="nj-theme-num" x="282.1" y="32.0" text-anchor="middle">6</text>
|
||||
<line class="nj-charts-axis" x1="44" y1="208" x2="330" y2="208"/>
|
||||
<text class="nj-charts-note" x="8" y="262">speedup over 3.12.0 (log scale), more is better</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 11 KiB |
@@ -0,0 +1,379 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog nj-charts--heat" viewBox="0 0 784 510" role="img" aria-labelledby="nj-blog-uc-mac nj-blog-uc-mac-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-uc-mac">Use cases: time of each library relative to the fastest, Apple M1 Max</title>
|
||||
<desc id="nj-blog-uc-mac-d">Table of relative times, libraries by use case. nlohmann/json json_document validate: 1.00; nlohmann/json json_document sum: 1.00; nlohmann/json json_document select: 1.00; nlohmann/json json_document edit: 1.00 (0.85 doing less, N); nlohmann/json json_document minify: 1.00 (0.85 doing less, N); nlohmann/json json_document write: 1.00 (0.71 doing less, N); yyjson validate: 1.37; yyjson sum: 1.11; yyjson select: 1.25; yyjson edit: 1.45; yyjson minify: 1.23 (1.16 doing less, N); yyjson write: 1.26; simdjson validate: 1.52; simdjson sum: 1.20; simdjson select: 1.33 (0.75 doing less, P); simdjson edit: n/a; simdjson minify: 1.73 (0.18 doing less, P); simdjson write: 2.41; sonic-rs (Rust) validate: 1.93; sonic-rs (Rust) sum: 1.53; sonic-rs (Rust) select: 1.83; sonic-rs (Rust) edit: 2.08; sonic-rs (Rust) minify: 1.93; sonic-rs (Rust) write: 2.38; sonic-cpp validate: no fully validating way (2.53 doing less, U); sonic-cpp sum: no fully validating way (1.86 doing less, U); sonic-cpp select: no fully validating way (2.31 doing less, U); sonic-cpp edit: no fully validating way (1.68 doing less, U); sonic-cpp minify: no fully validating way (2.03 doing less, U); sonic-cpp write: 1.59; simd-json (Rust) validate: 2.07; simd-json (Rust) sum: 1.62; simd-json (Rust) select: 2.38; simd-json (Rust) edit: 2.84; simd-json (Rust) minify: 3.40; simd-json (Rust) write: 3.10; Glaze validate: 2.04; Glaze sum: 3.85; Glaze select: 1.79 (0.82 doing less, P); Glaze edit: 4.41; Glaze minify: 5.19 (1.03 doing less, P); Glaze write: 2.23; Boost.J​SON validate: 2.56; Boost.J​SON sum: 1.99; Boost.J​SON select: 3.27; Boost.J​SON edit: 3.21; Boost.J​SON minify: 3.87; Boost.J​SON write: 3.75; serde_json (Rust) validate: 2.46 (2.23 doing less, U); serde_json (Rust) sum: 2.59; serde_json (Rust) select: 2.39 (2.24 doing less, U); serde_json (Rust) edit: 4.99; serde_json (Rust) minify: 5.85; serde_json (Rust) write: 2.95; nlohmann/json json validate: 2.71; nlohmann/json json sum: 1.96; nlohmann/json json select: 6.87; nlohmann/json json edit: 3.73; nlohmann/json json minify: 4.89; nlohmann/json json write: 2.10; RapidJSON validate: 4.72 (3.09 doing less, U); RapidJSON sum: 4.15 (2.85 doing less, U); RapidJSON select: 5.91 (3.82 doing less, U); RapidJSON edit: 4.82 (3.77 doing less, U); RapidJSON minify: 4.86 (3.60 doing less, U N); RapidJSON write: 5.88.</desc>
|
||||
<text class="nj-charts-tick" x="270" y="34">validate</text>
|
||||
<text class="nj-charts-tick" x="362" y="34">sum</text>
|
||||
<text class="nj-charts-tick" x="454" y="34">select</text>
|
||||
<text class="nj-charts-tick" x="546" y="34">edit</text>
|
||||
<text class="nj-charts-tick" x="638" y="34">minify</text>
|
||||
<text class="nj-charts-tick" x="730" y="34">write</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="66" text-anchor="end">nlohmann/json json_document</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · validate 1.00× the time of the fastest library (fully validating) way: accept twitter.json: 170 µs citm_catalog.json: 313 µs canada.json: 886 µs jeopardy.json: 20,873 µs">
|
||||
<rect class="nj-heat-0" x="225" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · sum 1.00× the time of the fastest library (fully validating) way: parse twitter.json: 224 µs citm_catalog.json: 485 µs canada.json: 1,816 µs jeopardy.json: 28,987 µs">
|
||||
<rect class="nj-heat-0" x="317" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · select 1.00× the time of the fastest library (fully validating) way: parse twitter.json: 184 µs citm_catalog.json: 363 µs canada.json: 956 µs jeopardy.json: 24,991 µs">
|
||||
<rect class="nj-heat-0" x="409" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit 1.00× the time of the fastest library (fully validating) way: editable twitter.json: 291 µs citm_catalog.json: 560 µs canada.json: 2,765 µs jeopardy.json: 58,057 µs">
|
||||
<rect class="nj-heat-0" x="501" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit, checking less 0.85× the time of the fastest fully validating library twitter.json: 283 µs · editable (source numbers) (validates fully) citm_catalog.json: 560 µs · editable (validates fully) canada.json: 1,484 µs · editable (source numbers) (validates fully) jeopardy.json: 57,635 µs · editable (source numbers) (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="547" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="60" text-anchor="middle">0.85</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify 1.00× the time of the fastest library (fully validating) way: parse + dump twitter.json: 259 µs citm_catalog.json: 493 µs canada.json: 2,582 µs jeopardy.json: 37,882 µs">
|
||||
<rect class="nj-heat-0" x="593" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify, checking less 0.85× the time of the fastest fully validating library twitter.json: 252 µs · parse + dump (source numbers) (validates fully) citm_catalog.json: 493 µs · parse + dump (validates fully) canada.json: 1,360 µs · parse + dump (source numbers) (validates fully) jeopardy.json: 37,817 µs · parse + dump (source numbers) (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="639" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="60" text-anchor="middle">0.85</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write 1.00× the time of the fastest library (fully validating) way: dump twitter.json: 74.3 µs citm_catalog.json: 134 µs canada.json: 1,621 µs jeopardy.json: 14,757 µs">
|
||||
<rect class="nj-heat-0" x="685" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="707.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write, checking less 0.71× the time of the fastest fully validating library twitter.json: 74.3 µs · dump (validates fully) citm_catalog.json: 134 µs · dump (validates fully) canada.json: 401 µs · dump (source numbers) (validates fully) jeopardy.json: 14,757 µs · dump (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="731" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="752.5" y="60" text-anchor="middle">0.71</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="752.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="102" text-anchor="end">yyjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · validate 1.37× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 172 µs citm_catalog.json: 451 µs canada.json: 1,457 µs jeopardy.json: 30,240 µs">
|
||||
<rect class="nj-heat-1" x="225" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="102" text-anchor="middle">1.37</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · sum 1.11× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 219 µs citm_catalog.json: 551 µs canada.json: 1,906 µs jeopardy.json: 37,512 µs">
|
||||
<rect class="nj-heat-0" x="317" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="102" text-anchor="middle">1.11</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · select 1.25× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 178 µs citm_catalog.json: 456 µs canada.json: 1,461 µs jeopardy.json: 32,514 µs">
|
||||
<rect class="nj-heat-1" x="409" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="102" text-anchor="middle">1.25</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · edit 1.45× the time of the fastest library (fully validating) way: insitu (copy untimed) + mut copy twitter.json: 427 µs citm_catalog.json: 882 µs canada.json: 3,642 µs jeopardy.json: 84,239 µs">
|
||||
<rect class="nj-heat-1" x="501" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="102" text-anchor="middle">1.45</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify 1.23× the time of the fastest library (fully validating) way: insitu (copy untimed) + write twitter.json: 279 µs citm_catalog.json: 625 µs canada.json: 3,196 µs jeopardy.json: 50,821 µs">
|
||||
<rect class="nj-heat-1" x="593" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="102" text-anchor="middle">1.23</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify, checking less 1.16× the time of the fastest fully validating library twitter.json: 279 µs · insitu (copy untimed) + write (validates fully) citm_catalog.json: 625 µs · insitu (copy untimed) + write (validates fully) canada.json: 2,550 µs · read (raw numbers) + write (validates fully) jeopardy.json: 50,821 µs · insitu (copy untimed) + write (validates fully) copies each number's text instead of formatting it (YYJSON_READ_NUMBER_AS_RAW)">
|
||||
<rect class="nj-heat-1" x="639" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="96" text-anchor="middle">1.16</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="109" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · write 1.26× the time of the fastest library (fully validating) way: write twitter.json: 103 µs citm_catalog.json: 169 µs canada.json: 1,731 µs jeopardy.json: 20,087 µs">
|
||||
<rect class="nj-heat-1" x="685" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="102" text-anchor="middle">1.26</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="138" text-anchor="end">simdjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · validate 1.52× the time of the fastest library (fully validating) way: D​OM twitter.json: 212 µs citm_catalog.json: 452 µs canada.json: 1,888 µs jeopardy.json: 28,843 µs">
|
||||
<rect class="nj-heat-2" x="225" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="138" text-anchor="middle">1.52</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · sum 1.20× the time of the fastest library (fully validating) twitter.json: 249 µs · D​OM citm_catalog.json: 571 µs · On-Demand canada.json: 2,374 µs · On-Demand jeopardy.json: 35,111 µs · D​OM">
|
||||
<rect class="nj-heat-1" x="317" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="138" text-anchor="middle">1.20</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select 1.33× the time of the fastest library (fully validating) way: D​OM twitter.json: 196 µs citm_catalog.json: 450 µs canada.json: 1,886 µs jeopardy.json: 30,504 µs">
|
||||
<rect class="nj-heat-1" x="409" y="117" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="138" text-anchor="middle">1.33</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select, checking less 0.75× the time of the fastest fully validating library twitter.json: 127 µs · On-Demand structs citm_catalog.json: 354 µs · On-Demand canada.json: 566 µs · On-Demand (key selectors) jeopardy.json: 19,562 µs · On-Demand reads lazily: On-Demand reads only what you ask for and steps over the rest by matching brackets">
|
||||
<rect class="nj-heat-0" x="455" y="117" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="132" text-anchor="middle">0.75</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="145" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · edit simdjson's documents are read-only: it has no A​PI to change a value and write the result">
|
||||
<rect class="nj-heat-na" x="501" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-tick" x="546" y="138">n/a</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify 1.73× the time of the fastest library (fully validating) way: D​OM + to_string twitter.json: 423 µs citm_catalog.json: 848 µs canada.json: 5,120 µs jeopardy.json: 61,059 µs">
|
||||
<rect class="nj-heat-2" x="593" y="117" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="138" text-anchor="middle">1.73</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify, checking less 0.18× the time of the fastest fully validating library way: minify twitter.json: 62.3 µs citm_catalog.json: 171 µs canada.json: 227 µs jeopardy.json: 5,762 µs simdjson::minify() only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="117" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="132" text-anchor="middle">0.18</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="145" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · write 2.41× the time of the fastest library (fully validating) way: to_string twitter.json: 199 µs citm_catalog.json: 385 µs canada.json: 3,241 µs jeopardy.json: 32,208 µs">
|
||||
<rect class="nj-heat-2" x="685" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="138" text-anchor="middle">2.41</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="174" text-anchor="end">sonic-rs (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · validate 1.93× the time of the fastest library (fully validating) way: Value twitter.json: 326 µs citm_catalog.json: 681 µs canada.json: 1,939 µs jeopardy.json: 31,450 µs">
|
||||
<rect class="nj-heat-2" x="225" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="174" text-anchor="middle">1.93</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · sum 1.53× the time of the fastest library (fully validating) way: visitor twitter.json: 364 µs citm_catalog.json: 778 µs canada.json: 2,703 µs jeopardy.json: 41,361 µs">
|
||||
<rect class="nj-heat-2" x="317" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="174" text-anchor="middle">1.53</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · select 1.83× the time of the fastest library (fully validating) way: Value twitter.json: 333 µs citm_catalog.json: 691 µs canada.json: 1,936 µs jeopardy.json: 40,660 µs">
|
||||
<rect class="nj-heat-2" x="409" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="174" text-anchor="middle">1.83</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · edit 2.08× the time of the fastest library (fully validating) way: Value twitter.json: 634 µs citm_catalog.json: 1,257 µs canada.json: 4,396 µs jeopardy.json: 140,936 µs">
|
||||
<rect class="nj-heat-2" x="501" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="174" text-anchor="middle">2.08</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · minify 1.93× the time of the fastest library (fully validating) way: Value twitter.json: 535 µs citm_catalog.json: 1,134 µs canada.json: 4,377 µs jeopardy.json: 64,832 µs">
|
||||
<rect class="nj-heat-2" x="593" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="174" text-anchor="middle">1.93</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · write 2.38× the time of the fastest library (fully validating) way: Value twitter.json: 212 µs citm_catalog.json: 446 µs canada.json: 2,419 µs jeopardy.json: 33,366 µs">
|
||||
<rect class="nj-heat-2" x="685" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="174" text-anchor="middle">2.38</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="210" text-anchor="end">sonic-cpp</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · validate, checking less 2.53× the time of the fastest fully validating library way: Document twitter.json: 382 µs citm_catalog.json: 985 µs canada.json: 2,578 µs jeopardy.json: 41,617 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-3" x="225" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="204" text-anchor="middle">2.53</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="270" y="217" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · sum, checking less 1.86× the time of the fastest fully validating library way: Document twitter.json: 428 µs citm_catalog.json: 1,087 µs canada.json: 2,993 µs jeopardy.json: 48,688 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="317" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="204" text-anchor="middle">1.86</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="362" y="217" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · select, checking less 2.31× the time of the fastest fully validating library way: Document twitter.json: 385 µs citm_catalog.json: 990 µs canada.json: 2,586 µs jeopardy.json: 45,858 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="409" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="204" text-anchor="middle">2.31</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="454" y="217" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · edit, checking less 1.68× the time of the fastest fully validating library way: Document twitter.json: 486 µs citm_catalog.json: 1,224 µs canada.json: 5,638 µs jeopardy.json: 62,688 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="501" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="204" text-anchor="middle">1.68</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="546" y="217" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · minify, checking less 2.03× the time of the fastest fully validating library way: Document + Serialize twitter.json: 500 µs citm_catalog.json: 1,220 µs canada.json: 5,676 µs jeopardy.json: 61,236 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="593" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="204" text-anchor="middle">2.03</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="638" y="217" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · write 1.59× the time of the fastest library (fully validating) way: Serialize twitter.json: 108 µs citm_catalog.json: 230 µs canada.json: 3,093 µs jeopardy.json: 19,651 µs">
|
||||
<rect class="nj-heat-2" x="685" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="210" text-anchor="middle">1.59</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="246" text-anchor="end">simd-json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · validate 2.07× the time of the fastest library (fully validating) way: tape (copy) twitter.json: 289 µs citm_catalog.json: 698 µs canada.json: 2,278 µs jeopardy.json: 38,874 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="225" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="246" text-anchor="middle">2.07</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · sum 1.62× the time of the fastest library (fully validating) way: visitor (copy) twitter.json: 354 µs citm_catalog.json: 866 µs canada.json: 2,717 µs jeopardy.json: 47,518 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="317" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="246" text-anchor="middle">1.62</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · select 2.38× the time of the fastest library (fully validating) way: structs (copy) twitter.json: 364 µs citm_catalog.json: 914 µs canada.json: 2,657 µs jeopardy.json: 57,697 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="409" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="246" text-anchor="middle">2.38</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · edit 2.84× the time of the fastest library (fully validating) way: borrowed (copy) twitter.json: 948 µs citm_catalog.json: 2,102 µs canada.json: 7,654 µs jeopardy.json: 110,693 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="246" text-anchor="middle">2.84</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · minify 3.40× the time of the fastest library (fully validating) way: borrowed (copy) twitter.json: 952 µs citm_catalog.json: 2,111 µs canada.json: 7,658 µs jeopardy.json: 108,130 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="593" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="246" text-anchor="middle">3.40</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · write 3.10× the time of the fastest library (fully validating) way: borrowed twitter.json: 355 µs citm_catalog.json: 478 µs canada.json: 2,728 µs jeopardy.json: 47,412 µs">
|
||||
<rect class="nj-heat-3" x="685" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="246" text-anchor="middle">3.10</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="282" text-anchor="end">Glaze</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · validate 2.04× the time of the fastest library (fully validating) way: validate_json twitter.json: 331 µs citm_catalog.json: 862 µs canada.json: 1,326 µs jeopardy.json: 45,192 µs">
|
||||
<rect class="nj-heat-2" x="225" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="282" text-anchor="middle">2.04</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · sum 3.85× the time of the fastest library (fully validating) way: generic (double, strict) twitter.json: 968 µs citm_catalog.json: 2,049 µs canada.json: 6,331 µs jeopardy.json: 99,763 µs">
|
||||
<rect class="nj-heat-3" x="317" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="282" text-anchor="middle">3.85</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select 1.79× the time of the fastest library (fully validating) way: structs (validate_skipped) twitter.json: 311 µs citm_catalog.json: 854 µs canada.json: 1,316 µs jeopardy.json: 46,924 µs">
|
||||
<rect class="nj-heat-2" x="409" y="261" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="282" text-anchor="middle">1.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select, checking less 0.82× the time of the fastest fully validating library way: structs twitter.json: 241 µs citm_catalog.json: 255 µs canada.json: 313 µs jeopardy.json: 37,578 µs reads into structs and steps over fields it doesn't know without checking them (validate_skipped checks them too)">
|
||||
<rect class="nj-heat-0" x="455" y="261" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="276" text-anchor="middle">0.82</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="289" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · edit 4.41× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 1,539 µs citm_catalog.json: 3,235 µs canada.json: 11,083 µs jeopardy.json: 178,333 µs">
|
||||
<rect class="nj-heat-3" x="501" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="282" text-anchor="middle">4.41</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify 5.19× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 1,505 µs citm_catalog.json: 3,225 µs canada.json: 11,092 µs jeopardy.json: 168,855 µs">
|
||||
<rect class="nj-heat-4" x="593" y="261" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="282" text-anchor="middle">5.19</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify, checking less 1.03× the time of the fastest fully validating library way: minify_json twitter.json: 281 µs citm_catalog.json: 729 µs canada.json: 1,722 µs jeopardy.json: 39,976 µs minify_json only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="261" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="276" text-anchor="middle">1.03</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="289" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · write 2.23× the time of the fastest library (fully validating) twitter.json: 216 µs · generic citm_catalog.json: 469 µs · generic canada.json: 1,720 µs · generic (strict) jeopardy.json: 33,934 µs · generic">
|
||||
<rect class="nj-heat-2" x="685" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="282" text-anchor="middle">2.23</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="318" text-anchor="end">Boost.J​SON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · validate 2.56× the time of the fastest library (fully validating) way: S​AX (numbers: none) twitter.json: 535 µs citm_catalog.json: 994 µs canada.json: 1,467 µs jeopardy.json: 53,939 µs">
|
||||
<rect class="nj-heat-3" x="225" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="318" text-anchor="middle">2.56</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · sum 1.99× the time of the fastest library (fully validating) way: S​AX twitter.json: 535 µs citm_catalog.json: 1,010 µs canada.json: 3,067 µs jeopardy.json: 53,704 µs">
|
||||
<rect class="nj-heat-2" x="317" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="318" text-anchor="middle">1.99</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · select 3.27× the time of the fastest library (fully validating) twitter.json: 617 µs · parse_into structs citm_catalog.json: 1,205 µs · parse_into structs canada.json: 3,650 µs · parse jeopardy.json: 67,255 µs · parse_into structs">
|
||||
<rect class="nj-heat-3" x="409" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="318" text-anchor="middle">3.27</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · edit 3.21× the time of the fastest library (fully validating) way: parse twitter.json: 1,368 µs citm_catalog.json: 1,992 µs canada.json: 6,573 µs jeopardy.json: 155,237 µs">
|
||||
<rect class="nj-heat-3" x="501" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="318" text-anchor="middle">3.21</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · minify 3.87× the time of the fastest library (fully validating) way: parse + serialize twitter.json: 1,393 µs citm_catalog.json: 1,986 µs canada.json: 6,542 µs jeopardy.json: 154,677 µs">
|
||||
<rect class="nj-heat-3" x="593" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="318" text-anchor="middle">3.87</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · write 3.75× the time of the fastest library (fully validating) way: serialize twitter.json: 507 µs citm_catalog.json: 508 µs canada.json: 2,923 µs jeopardy.json: 62,583 µs">
|
||||
<rect class="nj-heat-3" x="685" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="318" text-anchor="middle">3.75</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="354" text-anchor="end">serde_json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate 2.46× the time of the fastest library (fully validating) way: from_utf8 + IgnoredAny twitter.json: 452 µs citm_catalog.json: 1,103 µs canada.json: 1,556 µs jeopardy.json: 46,517 µs">
|
||||
<rect class="nj-heat-2" x="225" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="354" text-anchor="middle">2.46</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate, checking less 2.23× the time of the fastest fully validating library way: IgnoredAny twitter.json: 354 µs citm_catalog.json: 1,047 µs canada.json: 1,451 µs jeopardy.json: 44,984 µs trusts U​TF-8 in the strings it skips (from_slice); strings it reads are checked">
|
||||
<rect class="nj-heat-2" x="271" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="348" text-anchor="middle">2.23</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="361" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · sum 2.59× the time of the fastest library (fully validating) way: visitor twitter.json: 652 µs citm_catalog.json: 1,242 µs canada.json: 4,772 µs jeopardy.json: 66,568 µs">
|
||||
<rect class="nj-heat-3" x="317" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="354" text-anchor="middle">2.59</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · select 2.39× the time of the fastest library (fully validating) way: from_utf8 + structs twitter.json: 480 µs citm_catalog.json: 1,125 µs canada.json: 1,560 µs jeopardy.json: 62,378 µs">
|
||||
<rect class="nj-heat-2" x="409" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="354" text-anchor="middle">2.39</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · select, checking less 2.24× the time of the fastest fully validating library twitter.json: 410 µs · structs citm_catalog.json: 1,084 µs · structs canada.json: 1,455 µs · structs jeopardy.json: 62,378 µs · from_utf8 + structs (validates fully) trusts U​TF-8 in the strings it skips (from_slice); strings it reads are checked">
|
||||
<rect class="nj-heat-2" x="455" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="348" text-anchor="middle">2.24</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="361" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · edit 4.99× the time of the fastest library (fully validating) way: Value twitter.json: 2,009 µs citm_catalog.json: 3,316 µs canada.json: 9,666 µs jeopardy.json: 251,931 µs">
|
||||
<rect class="nj-heat-3" x="501" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="354" text-anchor="middle">4.99</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · minify 5.85× the time of the fastest library (fully validating) way: Value twitter.json: 2,004 µs citm_catalog.json: 3,290 µs canada.json: 9,792 µs jeopardy.json: 227,369 µs">
|
||||
<rect class="nj-heat-4" x="593" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="354" text-anchor="middle">5.85</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · write 2.95× the time of the fastest library (fully validating) way: Value twitter.json: 322 µs citm_catalog.json: 490 µs canada.json: 2,286 µs jeopardy.json: 49,967 µs">
|
||||
<rect class="nj-heat-3" x="685" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="354" text-anchor="middle">2.95</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="390" text-anchor="end">nlohmann/json json</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · validate 2.71× the time of the fastest library (fully validating) way: accept twitter.json: 451 µs citm_catalog.json: 888 µs canada.json: 2,405 µs jeopardy.json: 55,286 µs">
|
||||
<rect class="nj-heat-3" x="225" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="390" text-anchor="middle">2.71</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · sum 1.96× the time of the fastest library (fully validating) way: sax twitter.json: 465 µs citm_catalog.json: 925 µs canada.json: 3,072 µs jeopardy.json: 64,089 µs">
|
||||
<rect class="nj-heat-2" x="317" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="390" text-anchor="middle">1.96</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · select 6.87× the time of the fastest library (fully validating) twitter.json: 1,360 µs · structs (from_json) citm_catalog.json: 2,416 µs · parse canada.json: 6,047 µs · structs (from_json) jeopardy.json: 179,533 µs · parse">
|
||||
<rect class="nj-heat-4" x="409" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="390" text-anchor="middle">6.87</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · edit 3.73× the time of the fastest library (fully validating) twitter.json: 1,273 µs · ordered_json citm_catalog.json: 2,344 µs · ordered_json canada.json: 8,334 µs · parse jeopardy.json: 203,232 µs · ordered_json">
|
||||
<rect class="nj-heat-3" x="501" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="390" text-anchor="middle">3.73</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · minify 4.89× the time of the fastest library (fully validating) way: parse + dump twitter.json: 1,600 µs citm_catalog.json: 2,706 µs canada.json: 8,389 µs jeopardy.json: 197,745 µs">
|
||||
<rect class="nj-heat-3" x="593" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="390" text-anchor="middle">4.89</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · write 2.10× the time of the fastest library (fully validating) way: dump twitter.json: 223 µs citm_catalog.json: 287 µs canada.json: 2,276 µs jeopardy.json: 31,825 µs">
|
||||
<rect class="nj-heat-2" x="685" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="390" text-anchor="middle">2.10</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="426" text-anchor="end">RapidJSON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate 4.72× the time of the fastest library (fully validating) twitter.json: 1,307 µs · insitu (copy untimed) citm_catalog.json: 1,397 µs · S​AX (string stream, default precision) canada.json: 1,982 µs · S​AX (string stream, default precision) jeopardy.json: 134,679 µs · S​AX (string stream, default precision)">
|
||||
<rect class="nj-heat-3" x="225" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="426" text-anchor="middle">4.72</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate, checking less 3.09× the time of the fastest fully validating library twitter.json: 686 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,032 µs · S​AX (string stream, default precision) (no encoding check) canada.json: 1,982 µs · S​AX (string stream, default precision) (validates fully) jeopardy.json: 63,589 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="271" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="420" text-anchor="middle">3.09</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum 4.15× the time of the fastest library (fully validating) twitter.json: 1,329 µs · S​AX citm_catalog.json: 1,455 µs · S​AX (string stream) canada.json: 6,453 µs · S​AX (string stream) jeopardy.json: 136,103 µs · S​AX (string stream)">
|
||||
<rect class="nj-heat-3" x="317" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="339.5" y="426" text-anchor="middle">4.15</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum, checking less 2.85× the time of the fastest fully validating library twitter.json: 735 µs · S​AX (string stream) (no encoding check) citm_catalog.json: 1,136 µs · S​AX (string stream) (no encoding check) canada.json: 6,453 µs · S​AX (string stream) (validates fully) jeopardy.json: 69,604 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="363" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="384.5" y="420" text-anchor="middle">2.85</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="384.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select 5.91× the time of the fastest library (fully validating) twitter.json: 1,304 µs · insitu (copy untimed) citm_catalog.json: 1,554 µs · insitu (copy untimed) canada.json: 6,776 µs · Document (string stream) jeopardy.json: 141,509 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-4" x="409" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="426" text-anchor="middle">5.91</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select, checking less 3.82× the time of the fastest fully validating library twitter.json: 679 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,126 µs · insitu (copy untimed) (no encoding check) canada.json: 6,776 µs · Document (string stream) (validates fully) jeopardy.json: 65,625 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="455" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="420" text-anchor="middle">3.82</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit 4.82× the time of the fastest library (fully validating) twitter.json: 1,922 µs · Document citm_catalog.json: 2,388 µs · insitu (copy untimed) canada.json: 13,836 µs · Document (string stream) jeopardy.json: 221,270 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="501" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="426" text-anchor="middle">4.82</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit, checking less 3.77× the time of the fastest fully validating library way: insitu (copy untimed) (no encoding check) twitter.json: 1,344 µs citm_catalog.json: 1,964 µs canada.json: 13,794 µs jeopardy.json: 144,741 µs trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="547" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="420" text-anchor="middle">3.77</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify 4.86× the time of the fastest library (fully validating) twitter.json: 1,525 µs · S​AX to Writer citm_catalog.json: 1,808 µs · S​AX to Writer (string stream) canada.json: 14,460 µs · Document + Writer jeopardy.json: 174,558 µs · S​AX to Writer (string stream)">
|
||||
<rect class="nj-heat-3" x="593" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="426" text-anchor="middle">4.86</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify, checking less 3.60× the time of the fastest fully validating library twitter.json: 1,058 µs · S​AX to Writer (string stream) (no encoding check) citm_catalog.json: 1,485 µs · S​AX to Writer (string stream) (no encoding check) canada.json: 10,908 µs · S​AX to Writer (raw numbers) (no encoding check) jeopardy.json: 123,119 µs · S​AX to Writer (string stream) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it) copies each number's text instead of formatting it (kParseNumbersAsStringsFlag)">
|
||||
<rect class="nj-heat-3" x="639" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="420" text-anchor="middle">3.60</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="433" text-anchor="middle">U N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · write 5.88× the time of the fastest library (fully validating) way: Writer twitter.json: 603 µs citm_catalog.json: 830 µs canada.json: 6,995 µs jeopardy.json: 81,150 µs">
|
||||
<rect class="nj-heat-4" x="685" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="426" text-anchor="middle">5.88</text>
|
||||
</g>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="8" y="472">time relative to the fastest fully validating library, less is better</text>
|
||||
<g><rect class="nj-heat-0" x="8" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="46" y="496" text-anchor="middle">below 1.15</text></g>
|
||||
<g><rect class="nj-heat-1" x="88" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="126" y="496" text-anchor="middle">1.15 to 1.5</text></g>
|
||||
<g><rect class="nj-heat-2" x="168" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="206" y="496" text-anchor="middle">1.5 to 2.5</text></g>
|
||||
<g><rect class="nj-heat-3" x="248" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="286" y="496" text-anchor="middle">2.5 to 5</text></g>
|
||||
<g><rect class="nj-heat-4" x="328" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="366" y="496" text-anchor="middle">5 and more</text></g>
|
||||
<rect class="nj-heat-na" x="420" y="482" width="40" height="20" rx="3"/>
|
||||
<text class="nj-charts-tick" x="440" y="496">n/a</text>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="468" y="496">no A​PI for it</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 45 KiB |
@@ -0,0 +1,379 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog nj-charts--heat" viewBox="0 0 784 510" role="img" aria-labelledby="nj-blog-uc-x86-clang nj-blog-uc-x86-clang-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-uc-x86-clang">Use cases: time of each library relative to the fastest, x86-64 with Clang 23</title>
|
||||
<desc id="nj-blog-uc-x86-clang-d">Table of relative times, libraries by use case. nlohmann/json json_document validate: 1.00; nlohmann/json json_document sum: 1.00; nlohmann/json json_document select: 1.00; nlohmann/json json_document edit: 1.00 (0.81 doing less, N); nlohmann/json json_document minify: 1.00 (0.83 doing less, N); nlohmann/json json_document write: 1.00 (0.69 doing less, N); yyjson validate: 1.87; yyjson sum: 1.00; yyjson select: 1.23; yyjson edit: 1.43; yyjson minify: 1.16 (1.00 doing less, N); yyjson write: 1.14; sonic-cpp validate: no fully validating way (2.32 doing less, U); sonic-cpp sum: no fully validating way (1.20 doing less, U); sonic-cpp select: no fully validating way (1.53 doing less, U); sonic-cpp edit: no fully validating way (1.24 doing less, U); sonic-cpp minify: no fully validating way (1.38 doing less, U); sonic-cpp write: 1.28; simdjson validate: 2.03; simdjson sum: 1.13; simdjson select: 1.32 (0.57 doing less, P); simdjson edit: n/a; simdjson minify: 1.58 (0.18 doing less, P); simdjson write: 2.00; sonic-rs (Rust) validate: 1.88; sonic-rs (Rust) sum: 1.07; sonic-rs (Rust) select: 1.39; sonic-rs (Rust) edit: 1.90; sonic-rs (Rust) minify: 1.73; sonic-rs (Rust) write: 1.94; Boost.J​SON validate: 1.79; Boost.J​SON sum: 1.12; Boost.J​SON select: 2.24; Boost.J​SON edit: 2.39; Boost.J​SON minify: 2.68; Boost.J​SON write: 2.31; simd-json (Rust) validate: 3.52; simd-json (Rust) sum: 1.80; simd-json (Rust) select: 2.64; simd-json (Rust) edit: 2.88; simd-json (Rust) minify: 3.38; simd-json (Rust) write: 2.21; serde_json (Rust) validate: 2.33 (2.08 doing less, U); serde_json (Rust) sum: 2.22; serde_json (Rust) select: 1.77; serde_json (Rust) edit: 4.54; serde_json (Rust) minify: 4.92; serde_json (Rust) write: 2.15; Glaze validate: 2.23; Glaze sum: 4.03 (3.78 doing less, P); Glaze select: 1.43 (0.62 doing less, P); Glaze edit: 5.53; Glaze minify: 5.77 (0.70 doing less, P); Glaze write: 1.90; nlohmann/json json validate: 2.77; nlohmann/json json sum: 1.44; nlohmann/json json select: 7.56; nlohmann/json json edit: 3.99; nlohmann/json json minify: 4.91; nlohmann/json json write: 1.86; RapidJSON validate: 4.94 (3.76 doing less, U); RapidJSON sum: 2.98 (2.28 doing less, U); RapidJSON select: 4.20 (3.27 doing less, U); RapidJSON edit: 3.06 (2.60 doing less, U); RapidJSON minify: 3.61 (2.65 doing less, U N); RapidJSON write: 2.79.</desc>
|
||||
<text class="nj-charts-tick" x="270" y="34">validate</text>
|
||||
<text class="nj-charts-tick" x="362" y="34">sum</text>
|
||||
<text class="nj-charts-tick" x="454" y="34">select</text>
|
||||
<text class="nj-charts-tick" x="546" y="34">edit</text>
|
||||
<text class="nj-charts-tick" x="638" y="34">minify</text>
|
||||
<text class="nj-charts-tick" x="730" y="34">write</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="66" text-anchor="end">nlohmann/json json_document</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · validate 1.00× the time of the fastest library (fully validating) way: accept twitter.json: 255 µs citm_catalog.json: 512 µs canada.json: 1,055 µs jeopardy.json: 34,729 µs">
|
||||
<rect class="nj-heat-0" x="225" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · sum 1.00× the time of the fastest library (fully validating) way: parse twitter.json: 374 µs citm_catalog.json: 923 µs canada.json: 3,846 µs jeopardy.json: 85,286 µs">
|
||||
<rect class="nj-heat-0" x="317" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · select 1.00× the time of the fastest library (fully validating) twitter.json: 320 µs · parse citm_catalog.json: 759 µs · parse canada.json: 1,390 µs · structs (from_json) jeopardy.json: 88,083 µs · parse">
|
||||
<rect class="nj-heat-0" x="409" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit 1.00× the time of the fastest library (fully validating) way: editable twitter.json: 526 µs citm_catalog.json: 1,127 µs canada.json: 5,674 µs jeopardy.json: 196,370 µs">
|
||||
<rect class="nj-heat-0" x="501" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit, checking less 0.81× the time of the fastest fully validating library twitter.json: 526 µs · editable (validates fully) citm_catalog.json: 1,127 µs · editable (validates fully) canada.json: 2,443 µs · editable (source numbers) (validates fully) jeopardy.json: 196,370 µs · editable (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="547" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="60" text-anchor="middle">0.81</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify 1.00× the time of the fastest library (fully validating) way: parse + dump twitter.json: 518 µs citm_catalog.json: 1,040 µs canada.json: 5,043 µs jeopardy.json: 146,125 µs">
|
||||
<rect class="nj-heat-0" x="593" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify, checking less 0.83× the time of the fastest fully validating library twitter.json: 518 µs · parse + dump (validates fully) citm_catalog.json: 1,030 µs · parse + dump (source numbers) (validates fully) canada.json: 2,456 µs · parse + dump (source numbers) (validates fully) jeopardy.json: 146,125 µs · parse + dump (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="639" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="60" text-anchor="middle">0.83</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write 1.00× the time of the fastest library (fully validating) way: dump twitter.json: 160 µs citm_catalog.json: 311 µs canada.json: 3,714 µs jeopardy.json: 67,038 µs">
|
||||
<rect class="nj-heat-0" x="685" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="707.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write, checking less 0.69× the time of the fastest fully validating library way: dump (source numbers) twitter.json: 154 µs (validates fully) citm_catalog.json: 279 µs (validates fully) canada.json: 989 µs (validates fully) jeopardy.json: 64,301 µs (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="731" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="752.5" y="60" text-anchor="middle">0.69</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="752.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="102" text-anchor="end">yyjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · validate 1.87× the time of the fastest library (fully validating) twitter.json: 334 µs · insitu (copy untimed) citm_catalog.json: 811 µs · insitu (copy untimed) canada.json: 2,580 µs · read (raw numbers) jeopardy.json: 83,153 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-2" x="225" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="102" text-anchor="middle">1.87</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · sum 1.00× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 399 µs citm_catalog.json: 946 µs canada.json: 3,445 µs jeopardy.json: 88,447 µs">
|
||||
<rect class="nj-heat-0" x="317" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="102" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · select 1.23× the time of the fastest library (fully validating) twitter.json: 351 µs · insitu (copy untimed) citm_catalog.json: 788 µs · insitu (copy untimed) canada.json: 2,632 µs · read (raw numbers) jeopardy.json: 92,551 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-1" x="409" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="102" text-anchor="middle">1.23</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · edit 1.43× the time of the fastest library (fully validating) twitter.json: 918 µs · insitu (copy) + mut copy citm_catalog.json: 1,548 µs · insitu (copy untimed) + mut copy canada.json: 7,155 µs · insitu (copy untimed) + mut copy jeopardy.json: 270,654 µs · insitu (copy untimed) + mut copy (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-1" x="501" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="102" text-anchor="middle">1.43</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify 1.16× the time of the fastest library (fully validating) way: insitu (copy untimed) + write twitter.json: 620 µs citm_catalog.json: 1,189 µs canada.json: 6,283 µs jeopardy.json: 154,016 µs">
|
||||
<rect class="nj-heat-1" x="593" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="102" text-anchor="middle">1.16</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify, checking less 1.00× the time of the fastest fully validating library twitter.json: 620 µs · insitu (copy untimed) + write (validates fully) citm_catalog.json: 1,189 µs · insitu (copy untimed) + write (validates fully) canada.json: 3,472 µs · read (raw numbers) + write (validates fully) jeopardy.json: 154,016 µs · insitu (copy untimed) + write (validates fully) copies each number's text instead of formatting it (YYJSON_READ_NUMBER_AS_RAW)">
|
||||
<rect class="nj-heat-0" x="639" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="96" text-anchor="middle">1.00</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="109" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · write 1.14× the time of the fastest library (fully validating) way: write twitter.json: 218 µs citm_catalog.json: 386 µs canada.json: 3,476 µs jeopardy.json: 71,247 µs">
|
||||
<rect class="nj-heat-0" x="685" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="102" text-anchor="middle">1.14</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="138" text-anchor="end">sonic-cpp</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · validate, checking less 2.32× the time of the fastest fully validating library way: Document twitter.json: 448 µs citm_catalog.json: 1,032 µs canada.json: 3,143 µs jeopardy.json: 94,884 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="225" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="132" text-anchor="middle">2.32</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="270" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · sum, checking less 1.20× the time of the fastest fully validating library way: Document twitter.json: 502 µs citm_catalog.json: 1,175 µs canada.json: 3,754 µs jeopardy.json: 104,583 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="317" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="132" text-anchor="middle">1.20</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="362" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · select, checking less 1.53× the time of the fastest fully validating library way: Document twitter.json: 460 µs citm_catalog.json: 1,011 µs canada.json: 3,204 µs jeopardy.json: 108,245 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="409" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="132" text-anchor="middle">1.53</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="454" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · edit, checking less 1.24× the time of the fastest fully validating library way: Document twitter.json: 711 µs citm_catalog.json: 1,472 µs canada.json: 7,996 µs jeopardy.json: 183,852 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="501" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="132" text-anchor="middle">1.24</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="546" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · minify, checking less 1.38× the time of the fastest fully validating library way: Document + Serialize twitter.json: 710 µs citm_catalog.json: 1,485 µs canada.json: 8,122 µs jeopardy.json: 166,935 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="593" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="132" text-anchor="middle">1.38</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="638" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · write 1.28× the time of the fastest library (fully validating) way: Serialize twitter.json: 224 µs citm_catalog.json: 475 µs canada.json: 4,850 µs jeopardy.json: 65,131 µs">
|
||||
<rect class="nj-heat-1" x="685" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="138" text-anchor="middle">1.28</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="174" text-anchor="end">simdjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · validate 2.03× the time of the fastest library (fully validating) way: D​OM twitter.json: 306 µs citm_catalog.json: 732 µs canada.json: 3,206 µs jeopardy.json: 113,452 µs">
|
||||
<rect class="nj-heat-2" x="225" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="174" text-anchor="middle">2.03</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · sum 1.13× the time of the fastest library (fully validating) twitter.json: 394 µs · D​OM citm_catalog.json: 977 µs · D​OM canada.json: 4,117 µs · D​OM jeopardy.json: 114,602 µs · On-Demand">
|
||||
<rect class="nj-heat-0" x="317" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="174" text-anchor="middle">1.13</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select 1.32× the time of the fastest library (fully validating) way: D​OM twitter.json: 316 µs citm_catalog.json: 731 µs canada.json: 3,262 µs jeopardy.json: 120,808 µs">
|
||||
<rect class="nj-heat-1" x="409" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="174" text-anchor="middle">1.32</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select, checking less 0.57× the time of the fastest fully validating library twitter.json: 181 µs · On-Demand structs citm_catalog.json: 495 µs · On-Demand canada.json: 702 µs · On-Demand jeopardy.json: 48,823 µs · On-Demand reads lazily: On-Demand reads only what you ask for and steps over the rest by matching brackets">
|
||||
<rect class="nj-heat-0" x="455" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="168" text-anchor="middle">0.57</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · edit simdjson's documents are read-only: it has no A​PI to change a value and write the result">
|
||||
<rect class="nj-heat-na" x="501" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-tick" x="546" y="174">n/a</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify 1.58× the time of the fastest library (fully validating) way: D​OM + to_string twitter.json: 783 µs citm_catalog.json: 1,395 µs canada.json: 8,303 µs jeopardy.json: 275,007 µs">
|
||||
<rect class="nj-heat-2" x="593" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="174" text-anchor="middle">1.58</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify, checking less 0.18× the time of the fastest fully validating library way: minify twitter.json: 105 µs citm_catalog.json: 269 µs canada.json: 337 µs jeopardy.json: 45,087 µs simdjson::minify() only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="168" text-anchor="middle">0.18</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · write 2.00× the time of the fastest library (fully validating) way: to_string twitter.json: 389 µs citm_catalog.json: 656 µs canada.json: 4,896 µs jeopardy.json: 157,616 µs">
|
||||
<rect class="nj-heat-2" x="685" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="174" text-anchor="middle">2.00</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="210" text-anchor="end">sonic-rs (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · validate 1.88× the time of the fastest library (fully validating) way: IgnoredAny twitter.json: 501 µs citm_catalog.json: 970 µs canada.json: 2,249 µs jeopardy.json: 54,369 µs">
|
||||
<rect class="nj-heat-2" x="225" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="210" text-anchor="middle">1.88</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · sum 1.07× the time of the fastest library (fully validating) way: visitor twitter.json: 501 µs citm_catalog.json: 1,123 µs canada.json: 4,397 µs jeopardy.json: 59,583 µs">
|
||||
<rect class="nj-heat-0" x="317" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="210" text-anchor="middle">1.07</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · select 1.39× the time of the fastest library (fully validating) way: structs twitter.json: 504 µs citm_catalog.json: 1,033 µs canada.json: 2,328 µs jeopardy.json: 90,486 µs">
|
||||
<rect class="nj-heat-1" x="409" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="210" text-anchor="middle">1.39</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · edit 1.90× the time of the fastest library (fully validating) way: Value twitter.json: 1,197 µs citm_catalog.json: 2,389 µs canada.json: 7,744 µs jeopardy.json: 390,952 µs">
|
||||
<rect class="nj-heat-2" x="501" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="210" text-anchor="middle">1.90</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · minify 1.73× the time of the fastest library (fully validating) way: Value twitter.json: 1,000 µs citm_catalog.json: 2,097 µs canada.json: 7,795 µs jeopardy.json: 215,280 µs">
|
||||
<rect class="nj-heat-2" x="593" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="210" text-anchor="middle">1.73</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · write 1.94× the time of the fastest library (fully validating) way: Value twitter.json: 434 µs citm_catalog.json: 927 µs canada.json: 3,987 µs jeopardy.json: 109,176 µs">
|
||||
<rect class="nj-heat-2" x="685" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="210" text-anchor="middle">1.94</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="246" text-anchor="end">Boost.J​SON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · validate 1.79× the time of the fastest library (fully validating) way: S​AX (numbers: none) twitter.json: 571 µs citm_catalog.json: 910 µs canada.json: 1,684 µs jeopardy.json: 55,498 µs">
|
||||
<rect class="nj-heat-2" x="225" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="246" text-anchor="middle">1.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · sum 1.12× the time of the fastest library (fully validating) way: S​AX twitter.json: 580 µs citm_catalog.json: 928 µs canada.json: 5,809 µs jeopardy.json: 56,774 µs">
|
||||
<rect class="nj-heat-0" x="317" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="246" text-anchor="middle">1.12</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · select 2.24× the time of the fastest library (fully validating) twitter.json: 776 µs · parse_into structs citm_catalog.json: 1,389 µs · parse_into structs canada.json: 7,121 µs · parse jeopardy.json: 97,681 µs · parse_into structs">
|
||||
<rect class="nj-heat-2" x="409" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="246" text-anchor="middle">2.24</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · edit 2.39× the time of the fastest library (fully validating) way: parse twitter.json: 1,855 µs citm_catalog.json: 2,596 µs canada.json: 12,765 µs jeopardy.json: 350,286 µs">
|
||||
<rect class="nj-heat-2" x="501" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="246" text-anchor="middle">2.39</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · minify 2.68× the time of the fastest library (fully validating) way: parse + serialize twitter.json: 1,924 µs citm_catalog.json: 2,569 µs canada.json: 12,622 µs jeopardy.json: 329,090 µs">
|
||||
<rect class="nj-heat-3" x="593" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="246" text-anchor="middle">2.68</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · write 2.31× the time of the fastest library (fully validating) way: serialize twitter.json: 478 µs citm_catalog.json: 916 µs canada.json: 5,615 µs jeopardy.json: 141,846 µs">
|
||||
<rect class="nj-heat-2" x="685" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="246" text-anchor="middle">2.31</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="282" text-anchor="end">simd-json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · validate 3.52× the time of the fastest library (fully validating) way: tape (copy) twitter.json: 567 µs citm_catalog.json: 1,430 µs canada.json: 4,359 µs jeopardy.json: 207,551 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="225" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="282" text-anchor="middle">3.52</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · sum 1.80× the time of the fastest library (fully validating) way: visitor (copy) twitter.json: 681 µs citm_catalog.json: 1,650 µs canada.json: 5,083 µs jeopardy.json: 210,185 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="317" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="282" text-anchor="middle">1.80</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · select 2.64× the time of the fastest library (fully validating) way: structs (copy) twitter.json: 679 µs citm_catalog.json: 1,731 µs canada.json: 5,144 µs jeopardy.json: 239,164 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="409" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="282" text-anchor="middle">2.64</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · edit 2.88× the time of the fastest library (fully validating) twitter.json: 1,862 µs · borrowed (copy) citm_catalog.json: 4,194 µs · borrowed (copy) canada.json: 14,896 µs · owned (copy) jeopardy.json: 391,369 µs · borrowed (copy) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="282" text-anchor="middle">2.88</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · minify 3.38× the time of the fastest library (fully validating) way: borrowed (copy) twitter.json: 1,889 µs citm_catalog.json: 4,196 µs canada.json: 15,716 µs jeopardy.json: 414,377 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="593" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="282" text-anchor="middle">3.38</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · write 2.21× the time of the fastest library (fully validating) way: borrowed twitter.json: 582 µs citm_catalog.json: 800 µs canada.json: 5,147 µs jeopardy.json: 122,623 µs">
|
||||
<rect class="nj-heat-2" x="685" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="282" text-anchor="middle">2.21</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="318" text-anchor="end">serde_json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate 2.33× the time of the fastest library (fully validating) way: from_utf8 + IgnoredAny twitter.json: 624 µs citm_catalog.json: 1,440 µs canada.json: 2,406 µs jeopardy.json: 64,720 µs">
|
||||
<rect class="nj-heat-2" x="225" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="318" text-anchor="middle">2.33</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate, checking less 2.08× the time of the fastest fully validating library way: IgnoredAny twitter.json: 484 µs citm_catalog.json: 1,370 µs canada.json: 2,314 µs jeopardy.json: 58,247 µs trusts U​TF-8 in the strings it skips (from_slice); strings it reads are checked">
|
||||
<rect class="nj-heat-2" x="271" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="312" text-anchor="middle">2.08</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · sum 2.22× the time of the fastest library (fully validating) way: visitor twitter.json: 1,311 µs citm_catalog.json: 2,288 µs canada.json: 7,127 µs jeopardy.json: 129,497 µs">
|
||||
<rect class="nj-heat-2" x="317" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="318" text-anchor="middle">2.22</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · select 1.77× the time of the fastest library (fully validating) way: from_utf8 + structs twitter.json: 701 µs citm_catalog.json: 1,532 µs canada.json: 2,529 µs jeopardy.json: 107,316 µs">
|
||||
<rect class="nj-heat-2" x="409" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="318" text-anchor="middle">1.77</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · edit 4.54× the time of the fastest library (fully validating) way: Value twitter.json: 4,042 µs citm_catalog.json: 6,586 µs canada.json: 16,631 µs jeopardy.json: 632,766 µs">
|
||||
<rect class="nj-heat-3" x="501" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="318" text-anchor="middle">4.54</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · minify 4.92× the time of the fastest library (fully validating) way: Value twitter.json: 4,012 µs citm_catalog.json: 6,583 µs canada.json: 17,306 µs jeopardy.json: 509,702 µs">
|
||||
<rect class="nj-heat-3" x="593" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="318" text-anchor="middle">4.92</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · write 2.15× the time of the fastest library (fully validating) way: Value twitter.json: 550 µs citm_catalog.json: 887 µs canada.json: 4,005 µs jeopardy.json: 134,163 µs">
|
||||
<rect class="nj-heat-2" x="685" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="318" text-anchor="middle">2.15</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="354" text-anchor="end">Glaze</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · validate 2.23× the time of the fastest library (fully validating) way: validate_json twitter.json: 588 µs citm_catalog.json: 1,431 µs canada.json: 1,867 µs jeopardy.json: 75,571 µs">
|
||||
<rect class="nj-heat-2" x="225" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="354" text-anchor="middle">2.23</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · sum 4.03× the time of the fastest library (fully validating) way: generic (double, strict) twitter.json: 2,427 µs citm_catalog.json: 3,972 µs canada.json: 12,165 µs jeopardy.json: 253,385 µs">
|
||||
<rect class="nj-heat-3" x="317" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="339.5" y="354" text-anchor="middle">4.03</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · sum, checking less 3.78× the time of the fastest fully validating library twitter.json: 2,427 µs · generic (double, strict) (validates fully) citm_catalog.json: 3,972 µs · generic (double, strict) (validates fully) canada.json: 12,165 µs · generic (double, strict) (validates fully) jeopardy.json: 196,582 µs · lazy_json reads lazily: lazy_json reads only what you ask for and steps over the rest">
|
||||
<rect class="nj-heat-3" x="363" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="384.5" y="348" text-anchor="middle">3.78</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="384.5" y="361" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select 1.43× the time of the fastest library (fully validating) way: structs (validate_skipped) twitter.json: 544 µs citm_catalog.json: 1,368 µs canada.json: 1,924 µs jeopardy.json: 85,745 µs">
|
||||
<rect class="nj-heat-1" x="409" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="354" text-anchor="middle">1.43</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select, checking less 0.62× the time of the fastest fully validating library way: structs twitter.json: 345 µs citm_catalog.json: 419 µs canada.json: 444 µs jeopardy.json: 66,442 µs reads into structs and steps over fields it doesn't know without checking them (validate_skipped checks them too)">
|
||||
<rect class="nj-heat-0" x="455" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="348" text-anchor="middle">0.62</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="361" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · edit 5.53× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 4,341 µs citm_catalog.json: 7,322 µs canada.json: 26,786 µs jeopardy.json: 725,881 µs">
|
||||
<rect class="nj-heat-4" x="501" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="354" text-anchor="middle">5.53</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify 5.77× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 4,132 µs citm_catalog.json: 7,465 µs canada.json: 26,962 µs jeopardy.json: 528,811 µs">
|
||||
<rect class="nj-heat-4" x="593" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="354" text-anchor="middle">5.77</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify, checking less 0.70× the time of the fastest fully validating library way: minify_json twitter.json: 444 µs citm_catalog.json: 1,059 µs canada.json: 2,222 µs jeopardy.json: 91,153 µs minify_json only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="348" text-anchor="middle">0.70</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="361" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · write 1.90× the time of the fastest library (fully validating) way: generic twitter.json: 399 µs citm_catalog.json: 748 µs canada.json: 4,220 µs jeopardy.json: 128,020 µs">
|
||||
<rect class="nj-heat-2" x="685" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="354" text-anchor="middle">1.90</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="390" text-anchor="end">nlohmann/json json</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · validate 2.77× the time of the fastest library (fully validating) way: accept twitter.json: 658 µs citm_catalog.json: 1,390 µs canada.json: 4,265 µs jeopardy.json: 71,982 µs">
|
||||
<rect class="nj-heat-3" x="225" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="390" text-anchor="middle">2.77</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · sum 1.44× the time of the fastest library (fully validating) way: sax twitter.json: 728 µs citm_catalog.json: 1,393 µs canada.json: 5,428 µs jeopardy.json: 89,481 µs">
|
||||
<rect class="nj-heat-1" x="317" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="390" text-anchor="middle">1.44</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · select 7.56× the time of the fastest library (fully validating) twitter.json: 3,602 µs · structs (from_json) citm_catalog.json: 5,124 µs · parse canada.json: 11,831 µs · parse jeopardy.json: 444,210 µs · parse">
|
||||
<rect class="nj-heat-4" x="409" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="390" text-anchor="middle">7.56</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · edit 3.99× the time of the fastest library (fully validating) twitter.json: 3,069 µs · ordered_json citm_catalog.json: 4,905 µs · ordered_json canada.json: 16,702 µs · parse jeopardy.json: 666,261 µs · ordered_json">
|
||||
<rect class="nj-heat-3" x="501" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="390" text-anchor="middle">3.99</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · minify 4.91× the time of the fastest library (fully validating) way: parse + dump twitter.json: 4,445 µs citm_catalog.json: 5,713 µs canada.json: 16,711 µs jeopardy.json: 543,033 µs">
|
||||
<rect class="nj-heat-3" x="593" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="390" text-anchor="middle">4.91</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · write 1.86× the time of the fastest library (fully validating) way: dump twitter.json: 451 µs citm_catalog.json: 628 µs canada.json: 4,506 µs jeopardy.json: 116,529 µs">
|
||||
<rect class="nj-heat-2" x="685" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="390" text-anchor="middle">1.86</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="426" text-anchor="end">RapidJSON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate 4.94× the time of the fastest library (fully validating) twitter.json: 1,756 µs · insitu (copy untimed) citm_catalog.json: 1,971 µs · S​AX (default precision) canada.json: 4,118 µs · S​AX (string stream, default precision) jeopardy.json: 198,915 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="225" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="426" text-anchor="middle">4.94</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate, checking less 3.76× the time of the fastest fully validating library twitter.json: 1,132 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,572 µs · S​AX (default precision) (no encoding check) canada.json: 4,083 µs · S​AX (string stream, default precision) (no encoding check) jeopardy.json: 131,204 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="271" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="420" text-anchor="middle">3.76</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum 2.98× the time of the fastest library (fully validating) twitter.json: 1,816 µs · insitu (copy untimed) citm_catalog.json: 2,224 µs · S​AX canada.json: 10,719 µs · S​AX (string stream) jeopardy.json: 206,811 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="317" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="339.5" y="426" text-anchor="middle">2.98</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum, checking less 2.28× the time of the fastest fully validating library twitter.json: 1,187 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,765 µs · S​AX (no encoding check) canada.json: 10,719 µs · S​AX (string stream) (validates fully) jeopardy.json: 135,945 µs · S​AX (string stream) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-2" x="363" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="384.5" y="420" text-anchor="middle">2.28</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="384.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select 4.20× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 1,762 µs citm_catalog.json: 2,198 µs canada.json: 11,464 µs jeopardy.json: 209,290 µs">
|
||||
<rect class="nj-heat-3" x="409" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="426" text-anchor="middle">4.20</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select, checking less 3.27× the time of the fastest fully validating library twitter.json: 1,144 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,817 µs · insitu (copy untimed) (no encoding check) canada.json: 11,464 µs · insitu (copy untimed) (validates fully) jeopardy.json: 142,852 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="455" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="420" text-anchor="middle">3.27</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit 3.06× the time of the fastest library (fully validating) twitter.json: 2,635 µs · insitu (copy) citm_catalog.json: 3,103 µs · insitu (copy untimed) canada.json: 21,139 µs · insitu (copy untimed) jeopardy.json: 333,913 µs · insitu (copy untimed) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="426" text-anchor="middle">3.06</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit, checking less 2.60× the time of the fastest fully validating library twitter.json: 1,952 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 2,728 µs · insitu (copy untimed) (no encoding check) canada.json: 21,139 µs · insitu (copy untimed) (validates fully) jeopardy.json: 267,081 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="547" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="420" text-anchor="middle">2.60</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify 3.61× the time of the fastest library (fully validating) twitter.json: 2,808 µs · S​AX to Writer citm_catalog.json: 2,975 µs · S​AX to Writer canada.json: 22,589 µs · Document + Writer jeopardy.json: 358,807 µs · S​AX to Writer (string stream)">
|
||||
<rect class="nj-heat-3" x="593" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="426" text-anchor="middle">3.61</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify, checking less 2.65× the time of the fastest fully validating library twitter.json: 2,022 µs · S​AX to Writer (raw numbers) (no encoding check) citm_catalog.json: 2,480 µs · S​AX to Writer (no encoding check) canada.json: 14,986 µs · S​AX to Writer (raw numbers) (validates fully) jeopardy.json: 261,527 µs · S​AX to Writer (string stream) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it) copies each number's text instead of formatting it (kParseNumbersAsStringsFlag)">
|
||||
<rect class="nj-heat-3" x="639" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="420" text-anchor="middle">2.65</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="433" text-anchor="middle">U N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · write 2.79× the time of the fastest library (fully validating) way: Writer twitter.json: 627 µs citm_catalog.json: 1,008 µs canada.json: 9,596 µs jeopardy.json: 123,764 µs">
|
||||
<rect class="nj-heat-3" x="685" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="426" text-anchor="middle">2.79</text>
|
||||
</g>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="8" y="472">time relative to the fastest fully validating library, less is better</text>
|
||||
<g><rect class="nj-heat-0" x="8" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="46" y="496" text-anchor="middle">below 1.15</text></g>
|
||||
<g><rect class="nj-heat-1" x="88" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="126" y="496" text-anchor="middle">1.15 to 1.5</text></g>
|
||||
<g><rect class="nj-heat-2" x="168" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="206" y="496" text-anchor="middle">1.5 to 2.5</text></g>
|
||||
<g><rect class="nj-heat-3" x="248" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="286" y="496" text-anchor="middle">2.5 to 5</text></g>
|
||||
<g><rect class="nj-heat-4" x="328" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="366" y="496" text-anchor="middle">5 and more</text></g>
|
||||
<rect class="nj-heat-na" x="420" y="482" width="40" height="20" rx="3"/>
|
||||
<text class="nj-charts-tick" x="440" y="496">n/a</text>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="468" y="496">no A​PI for it</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 46 KiB |
@@ -0,0 +1,374 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog nj-charts--heat" viewBox="0 0 784 510" role="img" aria-labelledby="nj-blog-uc-x86-gcc nj-blog-uc-x86-gcc-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-uc-x86-gcc">Use cases: time of each library relative to the fastest, x86-64 with G​CC 16.2</title>
|
||||
<desc id="nj-blog-uc-x86-gcc-d">Table of relative times, libraries by use case. nlohmann/json json_document validate: 1.00; nlohmann/json json_document sum: 1.08; nlohmann/json json_document select: 1.00; nlohmann/json json_document edit: 1.00 (0.79 doing less, N); nlohmann/json json_document minify: 1.00 (0.80 doing less, N); nlohmann/json json_document write: 1.00 (0.64 doing less, N); yyjson validate: 1.94; yyjson sum: 1.14; yyjson select: 1.18; yyjson edit: 1.37; yyjson minify: 1.17 (0.95 doing less, N); yyjson write: 1.11; sonic-cpp validate: no fully validating way (2.32 doing less, U); sonic-cpp sum: no fully validating way (1.24 doing less, U); sonic-cpp select: no fully validating way (1.45 doing less, U); sonic-cpp edit: no fully validating way (1.21 doing less, U); sonic-cpp minify: no fully validating way (1.36 doing less, U); sonic-cpp write: 1.45; simdjson validate: 2.11; simdjson sum: 1.00; simdjson select: 1.27 (0.54 doing less, P); simdjson edit: n/a; simdjson minify: 1.54 (0.17 doing less, P); simdjson write: 2.10; sonic-rs (Rust) validate: 1.93; sonic-rs (Rust) sum: 1.13; sonic-rs (Rust) select: 1.34; sonic-rs (Rust) edit: 1.90; sonic-rs (Rust) minify: 1.71; sonic-rs (Rust) write: 2.04; Boost.J​SON validate: 1.99; Boost.J​SON sum: 1.27; Boost.J​SON select: 2.20; Boost.J​SON edit: 2.30; Boost.J​SON minify: 2.65; Boost.J​SON write: 2.36; simd-json (Rust) validate: 3.62; simd-json (Rust) sum: 1.91; simd-json (Rust) select: 2.56; simd-json (Rust) edit: 2.87; simd-json (Rust) minify: 3.35; simd-json (Rust) write: 2.32; RapidJSON validate: 3.71 (3.41 doing less, U); RapidJSON sum: 2.23 (2.09 doing less, U); RapidJSON select: 2.91 (2.73 doing less, U); RapidJSON edit: 2.41 (2.34 doing less, U); RapidJSON minify: 2.68 (2.42 doing less, U N); RapidJSON write: 2.97; serde_json (Rust) validate: 2.39 (2.14 doing less, U); serde_json (Rust) sum: 2.36; serde_json (Rust) select: 1.71; serde_json (Rust) edit: 4.53; serde_json (Rust) minify: 4.89; serde_json (Rust) write: 2.25; Glaze validate: 2.86; Glaze sum: 4.16; Glaze select: 1.79 (0.58 doing less, P); Glaze edit: 4.47; Glaze minify: 4.81 (0.78 doing less, P); Glaze write: 1.96; nlohmann/json json validate: 2.96; nlohmann/json json sum: 1.70; nlohmann/json json select: 7.12; nlohmann/json json edit: 3.83; nlohmann/json json minify: 4.79; nlohmann/json json write: 1.91.</desc>
|
||||
<text class="nj-charts-tick" x="270" y="34">validate</text>
|
||||
<text class="nj-charts-tick" x="362" y="34">sum</text>
|
||||
<text class="nj-charts-tick" x="454" y="34">select</text>
|
||||
<text class="nj-charts-tick" x="546" y="34">edit</text>
|
||||
<text class="nj-charts-tick" x="638" y="34">minify</text>
|
||||
<text class="nj-charts-tick" x="730" y="34">write</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="66" text-anchor="end">nlohmann/json json_document</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · validate 1.00× the time of the fastest library (fully validating) way: accept twitter.json: 258 µs citm_catalog.json: 513 µs canada.json: 934 µs jeopardy.json: 34,514 µs">
|
||||
<rect class="nj-heat-0" x="225" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · sum 1.08× the time of the fastest library (fully validating) way: parse twitter.json: 398 µs citm_catalog.json: 972 µs canada.json: 3,501 µs jeopardy.json: 89,756 µs">
|
||||
<rect class="nj-heat-0" x="317" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="66" text-anchor="middle">1.08</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · select 1.00× the time of the fastest library (fully validating) twitter.json: 333 µs · structs (from_json) citm_catalog.json: 828 µs · parse canada.json: 1,368 µs · parse jeopardy.json: 89,876 µs · parse">
|
||||
<rect class="nj-heat-0" x="409" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit 1.00× the time of the fastest library (fully validating) way: editable twitter.json: 536 µs citm_catalog.json: 1,162 µs canada.json: 5,567 µs jeopardy.json: 192,323 µs">
|
||||
<rect class="nj-heat-0" x="501" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit, checking less 0.79× the time of the fastest fully validating library twitter.json: 530 µs · editable (source numbers) (validates fully) citm_catalog.json: 1,149 µs · editable (source numbers) (validates fully) canada.json: 2,188 µs · editable (source numbers) (validates fully) jeopardy.json: 192,323 µs · editable (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="547" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="60" text-anchor="middle">0.79</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify 1.00× the time of the fastest library (fully validating) way: parse + dump twitter.json: 518 µs citm_catalog.json: 1,045 µs canada.json: 5,240 µs jeopardy.json: 143,737 µs">
|
||||
<rect class="nj-heat-0" x="593" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify, checking less 0.80× the time of the fastest fully validating library twitter.json: 496 µs · parse + dump (source numbers) (validates fully) citm_catalog.json: 1,045 µs · parse + dump (validates fully) canada.json: 2,196 µs · parse + dump (source numbers) (validates fully) jeopardy.json: 143,206 µs · parse + dump (source numbers) (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="639" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="60" text-anchor="middle">0.80</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write 1.00× the time of the fastest library (fully validating) way: dump twitter.json: 156 µs citm_catalog.json: 251 µs canada.json: 3,842 µs jeopardy.json: 67,769 µs">
|
||||
<rect class="nj-heat-0" x="685" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="707.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write, checking less 0.64× the time of the fastest fully validating library way: dump (source numbers) twitter.json: 140 µs (validates fully) citm_catalog.json: 230 µs (validates fully) canada.json: 823 µs (validates fully) jeopardy.json: 65,376 µs (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="731" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="752.5" y="60" text-anchor="middle">0.64</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="752.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="102" text-anchor="end">yyjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · validate 1.94× the time of the fastest library (fully validating) twitter.json: 352 µs · insitu (copy untimed) citm_catalog.json: 837 µs · insitu (copy untimed) canada.json: 2,199 µs · read (raw numbers) jeopardy.json: 93,043 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-2" x="225" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="102" text-anchor="middle">1.94</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · sum 1.14× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 415 µs citm_catalog.json: 986 µs canada.json: 3,818 µs jeopardy.json: 97,586 µs">
|
||||
<rect class="nj-heat-0" x="317" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="102" text-anchor="middle">1.14</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · select 1.18× the time of the fastest library (fully validating) twitter.json: 366 µs · insitu (copy untimed) citm_catalog.json: 840 µs · insitu (copy untimed) canada.json: 2,204 µs · read (raw numbers) jeopardy.json: 96,172 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-1" x="409" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="102" text-anchor="middle">1.18</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · edit 1.37× the time of the fastest library (fully validating) way: insitu (copy untimed) + mut copy twitter.json: 746 µs citm_catalog.json: 1,526 µs canada.json: 7,479 µs jeopardy.json: 275,025 µs">
|
||||
<rect class="nj-heat-1" x="501" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="102" text-anchor="middle">1.37</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify 1.17× the time of the fastest library (fully validating) twitter.json: 626 µs · insitu (copy) + write citm_catalog.json: 1,160 µs · insitu (copy untimed) + write canada.json: 6,701 µs · insitu (copy untimed) + write jeopardy.json: 156,605 µs · insitu (copy untimed) + write (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-1" x="593" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="102" text-anchor="middle">1.17</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify, checking less 0.95× the time of the fastest fully validating library twitter.json: 626 µs · insitu (copy) + write (validates fully) citm_catalog.json: 1,160 µs · insitu (copy untimed) + write (validates fully) canada.json: 2,901 µs · read (raw numbers) + write (validates fully) jeopardy.json: 156,605 µs · insitu (copy untimed) + write (validates fully) copies each number's text instead of formatting it (YYJSON_READ_NUMBER_AS_RAW) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-0" x="639" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="96" text-anchor="middle">0.95</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="109" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · write 1.11× the time of the fastest library (fully validating) way: write twitter.json: 215 µs citm_catalog.json: 319 µs canada.json: 3,360 µs jeopardy.json: 66,669 µs">
|
||||
<rect class="nj-heat-0" x="685" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="102" text-anchor="middle">1.11</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="138" text-anchor="end">sonic-cpp</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · validate, checking less 2.32× the time of the fastest fully validating library way: Document twitter.json: 403 µs citm_catalog.json: 932 µs canada.json: 3,349 µs jeopardy.json: 98,511 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="225" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="132" text-anchor="middle">2.32</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="270" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · sum, checking less 1.24× the time of the fastest fully validating library way: Document twitter.json: 456 µs citm_catalog.json: 1,115 µs canada.json: 3,980 µs jeopardy.json: 105,081 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="317" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="132" text-anchor="middle">1.24</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="362" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · select, checking less 1.45× the time of the fastest fully validating library way: Document twitter.json: 407 µs citm_catalog.json: 948 µs canada.json: 3,464 µs jeopardy.json: 110,885 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="409" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="132" text-anchor="middle">1.45</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="454" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · edit, checking less 1.21× the time of the fastest fully validating library way: Document twitter.json: 620 µs citm_catalog.json: 1,438 µs canada.json: 8,495 µs jeopardy.json: 186,078 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="501" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="132" text-anchor="middle">1.21</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="546" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · minify, checking less 1.36× the time of the fastest fully validating library way: Document + Serialize twitter.json: 675 µs citm_catalog.json: 1,417 µs canada.json: 8,958 µs jeopardy.json: 164,630 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="593" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="132" text-anchor="middle">1.36</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="638" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · write 1.45× the time of the fastest library (fully validating) way: Serialize twitter.json: 249 µs citm_catalog.json: 509 µs canada.json: 5,074 µs jeopardy.json: 69,916 µs">
|
||||
<rect class="nj-heat-1" x="685" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="138" text-anchor="middle">1.45</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="174" text-anchor="end">simdjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · validate 2.11× the time of the fastest library (fully validating) way: D​OM twitter.json: 301 µs citm_catalog.json: 695 µs canada.json: 3,337 µs jeopardy.json: 120,982 µs">
|
||||
<rect class="nj-heat-2" x="225" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="174" text-anchor="middle">2.11</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · sum 1.00× the time of the fastest library (fully validating) way: On-Demand twitter.json: 348 µs citm_catalog.json: 805 µs canada.json: 3,452 µs jeopardy.json: 92,769 µs">
|
||||
<rect class="nj-heat-0" x="317" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="174" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select 1.27× the time of the fastest library (fully validating) way: D​OM twitter.json: 313 µs citm_catalog.json: 699 µs canada.json: 3,325 µs jeopardy.json: 122,556 µs">
|
||||
<rect class="nj-heat-1" x="409" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="174" text-anchor="middle">1.27</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select, checking less 0.54× the time of the fastest fully validating library twitter.json: 180 µs · On-Demand citm_catalog.json: 496 µs · On-Demand (key selectors) canada.json: 690 µs · On-Demand (key selectors) jeopardy.json: 48,272 µs · On-Demand (key selectors) reads lazily: On-Demand reads only what you ask for and steps over the rest by matching brackets">
|
||||
<rect class="nj-heat-0" x="455" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="168" text-anchor="middle">0.54</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · edit simdjson's documents are read-only: it has no A​PI to change a value and write the result">
|
||||
<rect class="nj-heat-na" x="501" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-tick" x="546" y="174">n/a</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify 1.54× the time of the fastest library (fully validating) way: D​OM + to_string twitter.json: 714 µs citm_catalog.json: 1,318 µs canada.json: 9,135 µs jeopardy.json: 269,597 µs">
|
||||
<rect class="nj-heat-2" x="593" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="174" text-anchor="middle">1.54</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify, checking less 0.17× the time of the fastest fully validating library way: minify twitter.json: 99.9 µs citm_catalog.json: 278 µs canada.json: 312 µs jeopardy.json: 42,644 µs simdjson::minify() only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="168" text-anchor="middle">0.17</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · write 2.10× the time of the fastest library (fully validating) way: to_string twitter.json: 361 µs citm_catalog.json: 614 µs canada.json: 5,609 µs jeopardy.json: 158,492 µs">
|
||||
<rect class="nj-heat-2" x="685" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="174" text-anchor="middle">2.10</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="210" text-anchor="end">sonic-rs (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · validate 1.93× the time of the fastest library (fully validating) way: IgnoredAny twitter.json: 501 µs citm_catalog.json: 970 µs canada.json: 2,249 µs jeopardy.json: 54,369 µs">
|
||||
<rect class="nj-heat-2" x="225" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="210" text-anchor="middle">1.93</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · sum 1.13× the time of the fastest library (fully validating) way: visitor twitter.json: 501 µs citm_catalog.json: 1,123 µs canada.json: 4,397 µs jeopardy.json: 59,583 µs">
|
||||
<rect class="nj-heat-0" x="317" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="210" text-anchor="middle">1.13</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · select 1.34× the time of the fastest library (fully validating) way: structs twitter.json: 504 µs citm_catalog.json: 1,033 µs canada.json: 2,328 µs jeopardy.json: 90,486 µs">
|
||||
<rect class="nj-heat-1" x="409" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="210" text-anchor="middle">1.34</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · edit 1.90× the time of the fastest library (fully validating) way: Value twitter.json: 1,197 µs citm_catalog.json: 2,389 µs canada.json: 7,744 µs jeopardy.json: 390,952 µs">
|
||||
<rect class="nj-heat-2" x="501" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="210" text-anchor="middle">1.90</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · minify 1.71× the time of the fastest library (fully validating) way: Value twitter.json: 1,000 µs citm_catalog.json: 2,097 µs canada.json: 7,795 µs jeopardy.json: 215,280 µs">
|
||||
<rect class="nj-heat-2" x="593" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="210" text-anchor="middle">1.71</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · write 2.04× the time of the fastest library (fully validating) way: Value twitter.json: 434 µs citm_catalog.json: 927 µs canada.json: 3,987 µs jeopardy.json: 109,176 µs">
|
||||
<rect class="nj-heat-2" x="685" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="210" text-anchor="middle">2.04</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="246" text-anchor="end">Boost.J​SON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · validate 1.99× the time of the fastest library (fully validating) way: S​AX (numbers: none) twitter.json: 690 µs citm_catalog.json: 917 µs canada.json: 1,676 µs jeopardy.json: 62,781 µs">
|
||||
<rect class="nj-heat-2" x="225" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="246" text-anchor="middle">1.99</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · sum 1.27× the time of the fastest library (fully validating) way: S​AX twitter.json: 699 µs citm_catalog.json: 957 µs canada.json: 5,835 µs jeopardy.json: 59,656 µs">
|
||||
<rect class="nj-heat-1" x="317" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="246" text-anchor="middle">1.27</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · select 2.20× the time of the fastest library (fully validating) twitter.json: 887 µs · parse_into structs citm_catalog.json: 1,270 µs · parse_into structs canada.json: 7,292 µs · parse jeopardy.json: 95,866 µs · parse_into structs">
|
||||
<rect class="nj-heat-2" x="409" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="246" text-anchor="middle">2.20</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · edit 2.30× the time of the fastest library (fully validating) way: parse twitter.json: 1,767 µs citm_catalog.json: 2,493 µs canada.json: 12,767 µs jeopardy.json: 331,310 µs">
|
||||
<rect class="nj-heat-2" x="501" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="246" text-anchor="middle">2.30</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · minify 2.65× the time of the fastest library (fully validating) way: parse + serialize twitter.json: 1,974 µs citm_catalog.json: 2,525 µs canada.json: 12,748 µs jeopardy.json: 314,299 µs">
|
||||
<rect class="nj-heat-3" x="593" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="246" text-anchor="middle">2.65</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · write 2.36× the time of the fastest library (fully validating) way: serialize twitter.json: 469 µs citm_catalog.json: 830 µs canada.json: 5,659 µs jeopardy.json: 144,174 µs">
|
||||
<rect class="nj-heat-2" x="685" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="246" text-anchor="middle">2.36</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="282" text-anchor="end">simd-json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · validate 3.62× the time of the fastest library (fully validating) way: tape (copy) twitter.json: 567 µs citm_catalog.json: 1,430 µs canada.json: 4,359 µs jeopardy.json: 207,551 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="225" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="282" text-anchor="middle">3.62</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · sum 1.91× the time of the fastest library (fully validating) way: visitor (copy) twitter.json: 681 µs citm_catalog.json: 1,650 µs canada.json: 5,083 µs jeopardy.json: 210,185 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="317" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="282" text-anchor="middle">1.91</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · select 2.56× the time of the fastest library (fully validating) way: structs (copy) twitter.json: 679 µs citm_catalog.json: 1,731 µs canada.json: 5,144 µs jeopardy.json: 239,164 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="409" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="282" text-anchor="middle">2.56</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · edit 2.87× the time of the fastest library (fully validating) twitter.json: 1,862 µs · borrowed (copy) citm_catalog.json: 4,194 µs · borrowed (copy) canada.json: 14,896 µs · owned (copy) jeopardy.json: 391,369 µs · borrowed (copy) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="282" text-anchor="middle">2.87</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · minify 3.35× the time of the fastest library (fully validating) way: borrowed (copy) twitter.json: 1,889 µs citm_catalog.json: 4,196 µs canada.json: 15,716 µs jeopardy.json: 414,377 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="593" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="282" text-anchor="middle">3.35</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · write 2.32× the time of the fastest library (fully validating) way: borrowed twitter.json: 582 µs citm_catalog.json: 800 µs canada.json: 5,147 µs jeopardy.json: 122,623 µs">
|
||||
<rect class="nj-heat-2" x="685" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="282" text-anchor="middle">2.32</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="318" text-anchor="end">RapidJSON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate 3.71× the time of the fastest library (fully validating) twitter.json: 1,166 µs · insitu (copy untimed) citm_catalog.json: 1,553 µs · S​AX (string stream, default precision) canada.json: 3,875 µs · S​AX (string stream, default precision) jeopardy.json: 114,704 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="225" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="318" text-anchor="middle">3.71</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate, checking less 3.41× the time of the fastest fully validating library twitter.json: 1,012 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,434 µs · S​AX (default precision) (no encoding check) canada.json: 3,875 µs · S​AX (string stream, default precision) (validates fully) jeopardy.json: 102,635 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="271" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="312" text-anchor="middle">3.41</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum 2.23× the time of the fastest library (fully validating) twitter.json: 1,221 µs · insitu (copy untimed) citm_catalog.json: 1,717 µs · S​AX (string stream) canada.json: 9,435 µs · S​AX (string stream) jeopardy.json: 112,158 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-2" x="317" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="339.5" y="318" text-anchor="middle">2.23</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum, checking less 2.09× the time of the fastest fully validating library twitter.json: 1,063 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,635 µs · S​AX (string stream) (no encoding check) canada.json: 9,368 µs · S​AX (string stream) (no encoding check) jeopardy.json: 105,845 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-2" x="363" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="384.5" y="312" text-anchor="middle">2.09</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="384.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select 2.91× the time of the fastest library (fully validating) twitter.json: 1,180 µs · insitu (copy untimed) citm_catalog.json: 1,693 µs · insitu (copy untimed) canada.json: 10,390 µs · Document (string stream) jeopardy.json: 116,394 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="409" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="318" text-anchor="middle">2.91</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select, checking less 2.73× the time of the fastest fully validating library twitter.json: 1,022 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,648 µs · insitu (copy untimed) (no encoding check) canada.json: 10,390 µs · Document (string stream) (validates fully) jeopardy.json: 108,290 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="455" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="312" text-anchor="middle">2.73</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit 2.41× the time of the fastest library (fully validating) twitter.json: 1,865 µs · insitu (copy untimed) citm_catalog.json: 2,616 µs · insitu (copy untimed) canada.json: 18,812 µs · Document (string stream) jeopardy.json: 245,724 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-2" x="501" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="318" text-anchor="middle">2.41</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit, checking less 2.34× the time of the fastest fully validating library twitter.json: 1,737 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 2,595 µs · insitu (copy untimed) (no encoding check) canada.json: 18,812 µs · Document (string stream) (validates fully) jeopardy.json: 234,669 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-2" x="547" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="312" text-anchor="middle">2.34</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify 2.68× the time of the fastest library (fully validating) way: S​AX to Writer (string stream) twitter.json: 1,949 µs citm_catalog.json: 2,382 µs canada.json: 19,548 µs jeopardy.json: 231,979 µs">
|
||||
<rect class="nj-heat-3" x="593" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="318" text-anchor="middle">2.68</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify, checking less 2.42× the time of the fastest fully validating library twitter.json: 1,880 µs · S​AX to Writer (string stream) (no encoding check) citm_catalog.json: 2,314 µs · S​AX to Writer (string stream) (no encoding check) canada.json: 14,400 µs · S​AX to Writer (raw numbers) (validates fully) jeopardy.json: 224,249 µs · S​AX to Writer (string stream) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it) copies each number's text instead of formatting it (kParseNumbersAsStringsFlag)">
|
||||
<rect class="nj-heat-2" x="639" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="312" text-anchor="middle">2.42</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="325" text-anchor="middle">U N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · write 2.97× the time of the fastest library (fully validating) way: Writer twitter.json: 678 µs citm_catalog.json: 979 µs canada.json: 9,095 µs jeopardy.json: 131,408 µs">
|
||||
<rect class="nj-heat-3" x="685" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="318" text-anchor="middle">2.97</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="354" text-anchor="end">serde_json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate 2.39× the time of the fastest library (fully validating) way: from_utf8 + IgnoredAny twitter.json: 624 µs citm_catalog.json: 1,440 µs canada.json: 2,406 µs jeopardy.json: 64,720 µs">
|
||||
<rect class="nj-heat-2" x="225" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="354" text-anchor="middle">2.39</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate, checking less 2.14× the time of the fastest fully validating library way: IgnoredAny twitter.json: 484 µs citm_catalog.json: 1,370 µs canada.json: 2,314 µs jeopardy.json: 58,247 µs trusts U​TF-8 in the strings it skips (from_slice); strings it reads are checked">
|
||||
<rect class="nj-heat-2" x="271" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="348" text-anchor="middle">2.14</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="361" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · sum 2.36× the time of the fastest library (fully validating) way: visitor twitter.json: 1,311 µs citm_catalog.json: 2,288 µs canada.json: 7,127 µs jeopardy.json: 129,497 µs">
|
||||
<rect class="nj-heat-2" x="317" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="354" text-anchor="middle">2.36</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · select 1.71× the time of the fastest library (fully validating) way: from_utf8 + structs twitter.json: 701 µs citm_catalog.json: 1,532 µs canada.json: 2,529 µs jeopardy.json: 107,316 µs">
|
||||
<rect class="nj-heat-2" x="409" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="354" text-anchor="middle">1.71</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · edit 4.53× the time of the fastest library (fully validating) way: Value twitter.json: 4,042 µs citm_catalog.json: 6,586 µs canada.json: 16,631 µs jeopardy.json: 632,766 µs">
|
||||
<rect class="nj-heat-3" x="501" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="354" text-anchor="middle">4.53</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · minify 4.89× the time of the fastest library (fully validating) way: Value twitter.json: 4,012 µs citm_catalog.json: 6,583 µs canada.json: 17,306 µs jeopardy.json: 509,702 µs">
|
||||
<rect class="nj-heat-3" x="593" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="354" text-anchor="middle">4.89</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · write 2.25× the time of the fastest library (fully validating) way: Value twitter.json: 550 µs citm_catalog.json: 887 µs canada.json: 4,005 µs jeopardy.json: 134,163 µs">
|
||||
<rect class="nj-heat-2" x="685" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="354" text-anchor="middle">2.25</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="390" text-anchor="end">Glaze</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · validate 2.86× the time of the fastest library (fully validating) way: validate_json twitter.json: 712 µs citm_catalog.json: 1,983 µs canada.json: 2,625 µs jeopardy.json: 76,759 µs">
|
||||
<rect class="nj-heat-3" x="225" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="390" text-anchor="middle">2.86</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · sum 4.16× the time of the fastest library (fully validating) way: generic (double, strict) twitter.json: 2,483 µs citm_catalog.json: 4,413 µs canada.json: 10,532 µs jeopardy.json: 231,505 µs">
|
||||
<rect class="nj-heat-3" x="317" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="390" text-anchor="middle">4.16</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select 1.79× the time of the fastest library (fully validating) way: structs (validate_skipped) twitter.json: 606 µs citm_catalog.json: 2,476 µs canada.json: 2,557 µs jeopardy.json: 89,957 µs">
|
||||
<rect class="nj-heat-2" x="409" y="369" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="390" text-anchor="middle">1.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select, checking less 0.58× the time of the fastest fully validating library way: structs twitter.json: 344 µs citm_catalog.json: 402 µs canada.json: 417 µs jeopardy.json: 67,467 µs reads into structs and steps over fields it doesn't know without checking them (validate_skipped checks them too)">
|
||||
<rect class="nj-heat-0" x="455" y="369" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="384" text-anchor="middle">0.58</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="397" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · edit 4.47× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 3,389 µs citm_catalog.json: 6,002 µs canada.json: 21,598 µs jeopardy.json: 607,767 µs">
|
||||
<rect class="nj-heat-3" x="501" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="390" text-anchor="middle">4.47</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify 4.81× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 3,685 µs citm_catalog.json: 5,942 µs canada.json: 22,138 µs jeopardy.json: 450,322 µs">
|
||||
<rect class="nj-heat-3" x="593" y="369" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="390" text-anchor="middle">4.81</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify, checking less 0.78× the time of the fastest fully validating library way: minify_json twitter.json: 442 µs citm_catalog.json: 1,292 µs canada.json: 2,726 µs jeopardy.json: 97,377 µs minify_json only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="369" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="384" text-anchor="middle">0.78</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="397" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · write 1.96× the time of the fastest library (fully validating) way: generic twitter.json: 381 µs citm_catalog.json: 730 µs canada.json: 4,071 µs jeopardy.json: 131,946 µs">
|
||||
<rect class="nj-heat-2" x="685" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="390" text-anchor="middle">1.96</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="426" text-anchor="end">nlohmann/json json</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · validate 2.96× the time of the fastest library (fully validating) way: accept twitter.json: 683 µs citm_catalog.json: 1,419 µs canada.json: 4,559 µs jeopardy.json: 74,331 µs">
|
||||
<rect class="nj-heat-3" x="225" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="426" text-anchor="middle">2.96</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · sum 1.70× the time of the fastest library (fully validating) way: sax twitter.json: 814 µs citm_catalog.json: 1,666 µs canada.json: 5,690 µs jeopardy.json: 97,414 µs">
|
||||
<rect class="nj-heat-2" x="317" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="426" text-anchor="middle">1.70</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · select 7.12× the time of the fastest library (fully validating) twitter.json: 3,360 µs · structs (from_json) citm_catalog.json: 5,268 µs · structs (from_json) canada.json: 12,006 µs · structs (from_json) jeopardy.json: 410,221 µs · parse">
|
||||
<rect class="nj-heat-4" x="409" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="426" text-anchor="middle">7.12</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · edit 3.83× the time of the fastest library (fully validating) way: ordered_json twitter.json: 2,832 µs citm_catalog.json: 4,970 µs canada.json: 15,806 µs jeopardy.json: 647,704 µs">
|
||||
<rect class="nj-heat-3" x="501" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="426" text-anchor="middle">3.83</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · minify 4.79× the time of the fastest library (fully validating) way: parse + dump twitter.json: 4,196 µs citm_catalog.json: 5,806 µs canada.json: 16,626 µs jeopardy.json: 529,560 µs">
|
||||
<rect class="nj-heat-3" x="593" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="426" text-anchor="middle">4.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · write 1.91× the time of the fastest library (fully validating) way: dump twitter.json: 444 µs citm_catalog.json: 640 µs canada.json: 4,089 µs jeopardy.json: 117,316 µs">
|
||||
<rect class="nj-heat-2" x="685" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="426" text-anchor="middle">1.91</text>
|
||||
</g>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="8" y="472">time relative to the fastest fully validating library, less is better</text>
|
||||
<g><rect class="nj-heat-0" x="8" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="46" y="496" text-anchor="middle">below 1.15</text></g>
|
||||
<g><rect class="nj-heat-1" x="88" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="126" y="496" text-anchor="middle">1.15 to 1.5</text></g>
|
||||
<g><rect class="nj-heat-2" x="168" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="206" y="496" text-anchor="middle">1.5 to 2.5</text></g>
|
||||
<g><rect class="nj-heat-3" x="248" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="286" y="496" text-anchor="middle">2.5 to 5</text></g>
|
||||
<g><rect class="nj-heat-4" x="328" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="366" y="496" text-anchor="middle">5 and more</text></g>
|
||||
<rect class="nj-heat-na" x="420" y="482" width="40" height="20" rx="3"/>
|
||||
<text class="nj-charts-tick" x="440" y="496">n/a</text>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="468" y="496">no A​PI for it</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 45 KiB |
@@ -0,0 +1,374 @@
|
||||
<svg class="nj-fig nj-charts nj-charts--blog nj-charts--heat" viewBox="0 0 784 510" role="img" aria-labelledby="nj-blog-uc-x86-gcc13 nj-blog-uc-x86-gcc13-d" xmlns="http://www.w3.org/2000/svg">
|
||||
<title id="nj-blog-uc-x86-gcc13">Use cases: time of each library relative to the fastest, x86-64 with G​CC 13</title>
|
||||
<desc id="nj-blog-uc-x86-gcc13-d">Table of relative times, libraries by use case. nlohmann/json json_document validate: 1.00; nlohmann/json json_document sum: 1.08; nlohmann/json json_document select: 1.00; nlohmann/json json_document edit: 1.00 (0.83 doing less, N); nlohmann/json json_document minify: 1.00 (0.83 doing less, N); nlohmann/json json_document write: 1.00 (0.71 doing less, N); yyjson validate: 1.81; yyjson sum: 1.28; yyjson select: 1.22; yyjson edit: 1.49; yyjson minify: 1.27 (0.97 doing less, N); yyjson write: 1.14; sonic-cpp validate: no fully validating way (2.24 doing less, U); sonic-cpp sum: no fully validating way (1.28 doing less, U); sonic-cpp select: no fully validating way (1.53 doing less, U); sonic-cpp edit: no fully validating way (1.26 doing less, U); sonic-cpp minify: no fully validating way (1.42 doing less, U); sonic-cpp write: 1.50; simdjson validate: 2.01; simdjson sum: 1.00; simdjson select: 1.35 (0.57 doing less, P); simdjson edit: n/a; simdjson minify: 1.58 (0.22 doing less, P); simdjson write: 2.07; sonic-rs (Rust) validate: 1.79; sonic-rs (Rust) sum: 1.11; sonic-rs (Rust) select: 1.37; sonic-rs (Rust) edit: 1.91; sonic-rs (Rust) minify: 1.73; sonic-rs (Rust) write: 2.07; Boost.J​SON validate: 1.88; Boost.J​SON sum: 1.33; Boost.J​SON select: 2.30; Boost.J​SON edit: 2.55; Boost.J​SON minify: 2.92; Boost.J​SON write: 2.56; simd-json (Rust) validate: 3.35; simd-json (Rust) sum: 1.88; simd-json (Rust) select: 2.61; simd-json (Rust) edit: 2.89; simd-json (Rust) minify: 3.39; simd-json (Rust) write: 2.35; serde_json (Rust) validate: 2.22 (1.98 doing less, U); serde_json (Rust) sum: 2.32; serde_json (Rust) select: 1.75; serde_json (Rust) edit: 4.55; serde_json (Rust) minify: 4.94; serde_json (Rust) write: 2.28; Glaze validate: 2.21; Glaze sum: 4.04; Glaze select: 1.44 (0.60 doing less, P); Glaze edit: 4.85; Glaze minify: 5.10 (0.73 doing less, P); Glaze write: 1.84; nlohmann/json json validate: 2.74; nlohmann/json json sum: 1.67; nlohmann/json json select: 7.24; nlohmann/json json edit: 3.81; nlohmann/json json minify: 4.79; nlohmann/json json write: 1.99; RapidJSON validate: 4.50 (3.40 doing less, U); RapidJSON sum: 2.98 (2.29 doing less, U); RapidJSON select: 3.84 (3.06 doing less, U); RapidJSON edit: 2.92 (2.58 doing less, U); RapidJSON minify: 3.64 (2.64 doing less, U N); RapidJSON write: 3.11.</desc>
|
||||
<text class="nj-charts-tick" x="270" y="34">validate</text>
|
||||
<text class="nj-charts-tick" x="362" y="34">sum</text>
|
||||
<text class="nj-charts-tick" x="454" y="34">select</text>
|
||||
<text class="nj-charts-tick" x="546" y="34">edit</text>
|
||||
<text class="nj-charts-tick" x="638" y="34">minify</text>
|
||||
<text class="nj-charts-tick" x="730" y="34">write</text>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="66" text-anchor="end">nlohmann/json json_document</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · validate 1.00× the time of the fastest library (fully validating) way: accept twitter.json: 271 µs citm_catalog.json: 609 µs canada.json: 1,011 µs jeopardy.json: 34,722 µs">
|
||||
<rect class="nj-heat-0" x="225" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · sum 1.08× the time of the fastest library (fully validating) way: parse twitter.json: 392 µs citm_catalog.json: 946 µs canada.json: 3,888 µs jeopardy.json: 89,044 µs">
|
||||
<rect class="nj-heat-0" x="317" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="66" text-anchor="middle">1.08</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · select 1.00× the time of the fastest library (fully validating) way: parse twitter.json: 332 µs citm_catalog.json: 765 µs canada.json: 1,390 µs jeopardy.json: 88,202 µs">
|
||||
<rect class="nj-heat-0" x="409" y="45" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit 1.00× the time of the fastest library (fully validating) way: editable twitter.json: 532 µs citm_catalog.json: 1,116 µs canada.json: 5,714 µs jeopardy.json: 192,363 µs">
|
||||
<rect class="nj-heat-0" x="501" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · edit, checking less 0.83× the time of the fastest fully validating library twitter.json: 532 µs · editable (validates fully) citm_catalog.json: 1,116 µs · editable (validates fully) canada.json: 2,702 µs · editable (source numbers) (validates fully) jeopardy.json: 192,363 µs · editable (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="547" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="60" text-anchor="middle">0.83</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify 1.00× the time of the fastest library (fully validating) twitter.json: 483 µs · parse + dump citm_catalog.json: 1,014 µs · parse + dump canada.json: 5,459 µs · parse_copy + dump jeopardy.json: 146,320 µs · parse + dump">
|
||||
<rect class="nj-heat-0" x="593" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · minify, checking less 0.83× the time of the fastest fully validating library twitter.json: 483 µs · parse + dump (validates fully) citm_catalog.json: 1,014 µs · parse + dump (validates fully) canada.json: 2,620 µs · parse + dump (source numbers) (validates fully) jeopardy.json: 146,320 µs · parse + dump (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="639" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="60" text-anchor="middle">0.83</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write 1.00× the time of the fastest library (fully validating) way: dump twitter.json: 150 µs citm_catalog.json: 260 µs canada.json: 3,861 µs jeopardy.json: 63,958 µs">
|
||||
<rect class="nj-heat-0" x="685" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="707.5" y="66" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json_document · write, checking less 0.71× the time of the fastest fully validating library twitter.json: 148 µs · dump (source numbers) (validates fully) citm_catalog.json: 260 µs · dump (validates fully) canada.json: 998 µs · dump (source numbers) (validates fully) jeopardy.json: 63,958 µs · dump (validates fully) copies each number's text instead of formatting it (number_format::source)">
|
||||
<rect class="nj-heat-0" x="731" y="45" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="752.5" y="60" text-anchor="middle">0.71</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="752.5" y="73" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="102" text-anchor="end">yyjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · validate 1.81× the time of the fastest library (fully validating) twitter.json: 348 µs · insitu (copy untimed) citm_catalog.json: 878 µs · insitu (copy untimed) canada.json: 2,256 µs · read (raw numbers) jeopardy.json: 90,959 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-2" x="225" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="102" text-anchor="middle">1.81</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · sum 1.28× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 407 µs citm_catalog.json: 1,045 µs canada.json: 6,021 µs jeopardy.json: 99,764 µs">
|
||||
<rect class="nj-heat-1" x="317" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="102" text-anchor="middle">1.28</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · select 1.22× the time of the fastest library (fully validating) twitter.json: 361 µs · insitu (copy untimed) citm_catalog.json: 880 µs · insitu (copy untimed) canada.json: 2,236 µs · read (raw numbers) jeopardy.json: 98,637 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-1" x="409" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="102" text-anchor="middle">1.22</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · edit 1.49× the time of the fastest library (fully validating) way: insitu (copy untimed) + mut copy twitter.json: 761 µs citm_catalog.json: 1,590 µs canada.json: 9,860 µs jeopardy.json: 271,227 µs">
|
||||
<rect class="nj-heat-1" x="501" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="102" text-anchor="middle">1.49</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify 1.27× the time of the fastest library (fully validating) twitter.json: 592 µs · insitu (copy untimed) + write citm_catalog.json: 1,205 µs · insitu (copy untimed) + write canada.json: 9,008 µs · read + write jeopardy.json: 158,577 µs · insitu (copy untimed) + write">
|
||||
<rect class="nj-heat-1" x="593" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="102" text-anchor="middle">1.27</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · minify, checking less 0.97× the time of the fastest fully validating library twitter.json: 592 µs · insitu (copy untimed) + write (validates fully) citm_catalog.json: 1,205 µs · insitu (copy untimed) + write (validates fully) canada.json: 3,106 µs · read (raw numbers) + write (validates fully) jeopardy.json: 158,577 µs · insitu (copy untimed) + write (validates fully) copies each number's text instead of formatting it (YYJSON_READ_NUMBER_AS_RAW)">
|
||||
<rect class="nj-heat-0" x="639" y="81" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="96" text-anchor="middle">0.97</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="109" text-anchor="middle">N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="yyjson · write 1.14× the time of the fastest library (fully validating) way: write twitter.json: 204 µs citm_catalog.json: 327 µs canada.json: 3,748 µs jeopardy.json: 65,989 µs">
|
||||
<rect class="nj-heat-0" x="685" y="81" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="102" text-anchor="middle">1.14</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="138" text-anchor="end">sonic-cpp</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · validate, checking less 2.24× the time of the fastest fully validating library way: Document twitter.json: 408 µs citm_catalog.json: 1,028 µs canada.json: 3,622 µs jeopardy.json: 96,080 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="225" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="132" text-anchor="middle">2.24</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="270" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · sum, checking less 1.28× the time of the fastest fully validating library way: Document twitter.json: 460 µs citm_catalog.json: 1,210 µs canada.json: 4,295 µs jeopardy.json: 107,092 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="317" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="132" text-anchor="middle">1.28</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="362" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · select, checking less 1.53× the time of the fastest fully validating library way: Document twitter.json: 413 µs citm_catalog.json: 1,043 µs canada.json: 3,695 µs jeopardy.json: 108,297 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-2" x="409" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="132" text-anchor="middle">1.53</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="454" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · edit, checking less 1.26× the time of the fastest fully validating library way: Document twitter.json: 637 µs citm_catalog.json: 1,559 µs canada.json: 8,936 µs jeopardy.json: 186,232 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="501" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="132" text-anchor="middle">1.26</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="546" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · minify, checking less 1.42× the time of the fastest fully validating library way: Document + Serialize twitter.json: 695 µs citm_catalog.json: 1,541 µs canada.json: 8,838 µs jeopardy.json: 168,901 µs trusts U​TF-8: sonic-cpp 1.0.2 doesn't check it">
|
||||
<rect class="nj-heat-1" x="593" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="132" text-anchor="middle">1.42</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="638" y="145" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-cpp · write 1.50× the time of the fastest library (fully validating) way: Serialize twitter.json: 256 µs citm_catalog.json: 541 µs canada.json: 5,120 µs jeopardy.json: 69,546 µs">
|
||||
<rect class="nj-heat-2" x="685" y="117" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="138" text-anchor="middle">1.50</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="174" text-anchor="end">simdjson</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · validate 2.01× the time of the fastest library (fully validating) way: D​OM twitter.json: 311 µs citm_catalog.json: 780 µs canada.json: 3,351 µs jeopardy.json: 116,704 µs">
|
||||
<rect class="nj-heat-2" x="225" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="174" text-anchor="middle">2.01</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · sum 1.00× the time of the fastest library (fully validating) way: On-Demand twitter.json: 356 µs citm_catalog.json: 812 µs canada.json: 3,435 µs jeopardy.json: 96,250 µs">
|
||||
<rect class="nj-heat-0" x="317" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="174" text-anchor="middle">1.00</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select 1.35× the time of the fastest library (fully validating) way: D​OM twitter.json: 324 µs citm_catalog.json: 756 µs canada.json: 3,409 µs jeopardy.json: 123,214 µs">
|
||||
<rect class="nj-heat-1" x="409" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="174" text-anchor="middle">1.35</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · select, checking less 0.57× the time of the fastest fully validating library twitter.json: 184 µs · On-Demand (key selectors) citm_catalog.json: 509 µs · On-Demand canada.json: 700 µs · On-Demand jeopardy.json: 48,614 µs · On-Demand reads lazily: On-Demand reads only what you ask for and steps over the rest by matching brackets">
|
||||
<rect class="nj-heat-0" x="455" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="168" text-anchor="middle">0.57</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · edit simdjson's documents are read-only: it has no A​PI to change a value and write the result">
|
||||
<rect class="nj-heat-na" x="501" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-tick" x="546" y="174">n/a</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify 1.58× the time of the fastest library (fully validating) way: D​OM + to_string twitter.json: 742 µs citm_catalog.json: 1,393 µs canada.json: 8,808 µs jeopardy.json: 266,718 µs">
|
||||
<rect class="nj-heat-2" x="593" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="174" text-anchor="middle">1.58</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · minify, checking less 0.22× the time of the fastest fully validating library way: minify twitter.json: 123 µs citm_catalog.json: 337 µs canada.json: 433 µs jeopardy.json: 47,040 µs simdjson::minify() only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="153" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="168" text-anchor="middle">0.22</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="181" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simdjson · write 2.07× the time of the fastest library (fully validating) way: to_string twitter.json: 359 µs citm_catalog.json: 637 µs canada.json: 4,999 µs jeopardy.json: 154,364 µs">
|
||||
<rect class="nj-heat-2" x="685" y="153" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="174" text-anchor="middle">2.07</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="210" text-anchor="end">sonic-rs (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · validate 1.79× the time of the fastest library (fully validating) way: IgnoredAny twitter.json: 501 µs citm_catalog.json: 970 µs canada.json: 2,249 µs jeopardy.json: 54,369 µs">
|
||||
<rect class="nj-heat-2" x="225" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="210" text-anchor="middle">1.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · sum 1.11× the time of the fastest library (fully validating) way: visitor twitter.json: 501 µs citm_catalog.json: 1,123 µs canada.json: 4,397 µs jeopardy.json: 59,583 µs">
|
||||
<rect class="nj-heat-0" x="317" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="210" text-anchor="middle">1.11</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · select 1.37× the time of the fastest library (fully validating) way: structs twitter.json: 504 µs citm_catalog.json: 1,033 µs canada.json: 2,328 µs jeopardy.json: 90,486 µs">
|
||||
<rect class="nj-heat-1" x="409" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="210" text-anchor="middle">1.37</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · edit 1.91× the time of the fastest library (fully validating) way: Value twitter.json: 1,197 µs citm_catalog.json: 2,389 µs canada.json: 7,744 µs jeopardy.json: 390,952 µs">
|
||||
<rect class="nj-heat-2" x="501" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="210" text-anchor="middle">1.91</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · minify 1.73× the time of the fastest library (fully validating) way: Value twitter.json: 1,000 µs citm_catalog.json: 2,097 µs canada.json: 7,795 µs jeopardy.json: 215,280 µs">
|
||||
<rect class="nj-heat-2" x="593" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="210" text-anchor="middle">1.73</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="sonic-rs (Rust) · write 2.07× the time of the fastest library (fully validating) way: Value twitter.json: 434 µs citm_catalog.json: 927 µs canada.json: 3,987 µs jeopardy.json: 109,176 µs">
|
||||
<rect class="nj-heat-2" x="685" y="189" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="210" text-anchor="middle">2.07</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="246" text-anchor="end">Boost.J​SON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · validate 1.88× the time of the fastest library (fully validating) way: S​AX (numbers: none) twitter.json: 710 µs citm_catalog.json: 969 µs canada.json: 1,718 µs jeopardy.json: 61,476 µs">
|
||||
<rect class="nj-heat-2" x="225" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="246" text-anchor="middle">1.88</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · sum 1.33× the time of the fastest library (fully validating) way: S​AX twitter.json: 734 µs citm_catalog.json: 1,030 µs canada.json: 6,103 µs jeopardy.json: 64,382 µs">
|
||||
<rect class="nj-heat-1" x="317" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="246" text-anchor="middle">1.33</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · select 2.30× the time of the fastest library (fully validating) twitter.json: 884 µs · parse_into structs citm_catalog.json: 1,380 µs · parse_into structs canada.json: 7,217 µs · parse jeopardy.json: 99,078 µs · parse_into structs">
|
||||
<rect class="nj-heat-2" x="409" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="246" text-anchor="middle">2.30</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · edit 2.55× the time of the fastest library (fully validating) way: parse twitter.json: 1,963 µs citm_catalog.json: 2,936 µs canada.json: 13,414 µs jeopardy.json: 356,244 µs">
|
||||
<rect class="nj-heat-3" x="501" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="246" text-anchor="middle">2.55</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · minify 2.92× the time of the fastest library (fully validating) way: parse + serialize twitter.json: 2,086 µs citm_catalog.json: 2,919 µs canada.json: 13,974 µs jeopardy.json: 334,468 µs">
|
||||
<rect class="nj-heat-3" x="593" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="246" text-anchor="middle">2.92</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Boost.J​SON · write 2.56× the time of the fastest library (fully validating) way: serialize twitter.json: 480 µs citm_catalog.json: 1,016 µs canada.json: 6,154 µs jeopardy.json: 139,022 µs">
|
||||
<rect class="nj-heat-3" x="685" y="225" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="246" text-anchor="middle">2.56</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="282" text-anchor="end">simd-json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · validate 3.35× the time of the fastest library (fully validating) way: tape (copy) twitter.json: 567 µs citm_catalog.json: 1,430 µs canada.json: 4,359 µs jeopardy.json: 207,551 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="225" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="282" text-anchor="middle">3.35</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · sum 1.88× the time of the fastest library (fully validating) way: visitor (copy) twitter.json: 681 µs citm_catalog.json: 1,650 µs canada.json: 5,083 µs jeopardy.json: 210,185 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-2" x="317" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="282" text-anchor="middle">1.88</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · select 2.61× the time of the fastest library (fully validating) way: structs (copy) twitter.json: 679 µs citm_catalog.json: 1,731 µs canada.json: 5,144 µs jeopardy.json: 239,164 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="409" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="282" text-anchor="middle">2.61</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · edit 2.89× the time of the fastest library (fully validating) twitter.json: 1,862 µs · borrowed (copy) citm_catalog.json: 4,194 µs · borrowed (copy) canada.json: 14,896 µs · owned (copy) jeopardy.json: 391,369 µs · borrowed (copy) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="282" text-anchor="middle">2.89</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · minify 3.39× the time of the fastest library (fully validating) way: borrowed (copy) twitter.json: 1,889 µs citm_catalog.json: 4,196 µs canada.json: 15,716 µs jeopardy.json: 414,377 µs (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="593" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="282" text-anchor="middle">3.39</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="simd-json (Rust) · write 2.35× the time of the fastest library (fully validating) way: borrowed twitter.json: 582 µs citm_catalog.json: 800 µs canada.json: 5,147 µs jeopardy.json: 122,623 µs">
|
||||
<rect class="nj-heat-2" x="685" y="261" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="282" text-anchor="middle">2.35</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="318" text-anchor="end">serde_json (Rust)</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate 2.22× the time of the fastest library (fully validating) way: from_utf8 + IgnoredAny twitter.json: 624 µs citm_catalog.json: 1,440 µs canada.json: 2,406 µs jeopardy.json: 64,720 µs">
|
||||
<rect class="nj-heat-2" x="225" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="318" text-anchor="middle">2.22</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · validate, checking less 1.98× the time of the fastest fully validating library way: IgnoredAny twitter.json: 484 µs citm_catalog.json: 1,370 µs canada.json: 2,314 µs jeopardy.json: 58,247 µs trusts U​TF-8 in the strings it skips (from_slice); strings it reads are checked">
|
||||
<rect class="nj-heat-2" x="271" y="297" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="312" text-anchor="middle">1.98</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="325" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · sum 2.32× the time of the fastest library (fully validating) way: visitor twitter.json: 1,311 µs citm_catalog.json: 2,288 µs canada.json: 7,127 µs jeopardy.json: 129,497 µs">
|
||||
<rect class="nj-heat-2" x="317" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="318" text-anchor="middle">2.32</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · select 1.75× the time of the fastest library (fully validating) way: from_utf8 + structs twitter.json: 701 µs citm_catalog.json: 1,532 µs canada.json: 2,529 µs jeopardy.json: 107,316 µs">
|
||||
<rect class="nj-heat-2" x="409" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="318" text-anchor="middle">1.75</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · edit 4.55× the time of the fastest library (fully validating) way: Value twitter.json: 4,042 µs citm_catalog.json: 6,586 µs canada.json: 16,631 µs jeopardy.json: 632,766 µs">
|
||||
<rect class="nj-heat-3" x="501" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="318" text-anchor="middle">4.55</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · minify 4.94× the time of the fastest library (fully validating) way: Value twitter.json: 4,012 µs citm_catalog.json: 6,583 µs canada.json: 17,306 µs jeopardy.json: 509,702 µs">
|
||||
<rect class="nj-heat-3" x="593" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="318" text-anchor="middle">4.94</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="serde_json (Rust) · write 2.28× the time of the fastest library (fully validating) way: Value twitter.json: 550 µs citm_catalog.json: 887 µs canada.json: 4,005 µs jeopardy.json: 134,163 µs">
|
||||
<rect class="nj-heat-2" x="685" y="297" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="318" text-anchor="middle">2.28</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="354" text-anchor="end">Glaze</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · validate 2.21× the time of the fastest library (fully validating) way: validate_json twitter.json: 590 µs citm_catalog.json: 1,545 µs canada.json: 1,980 µs jeopardy.json: 76,009 µs">
|
||||
<rect class="nj-heat-2" x="225" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="354" text-anchor="middle">2.21</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · sum 4.04× the time of the fastest library (fully validating) way: generic (double, strict) twitter.json: 2,345 µs citm_catalog.json: 4,080 µs canada.json: 10,576 µs jeopardy.json: 250,685 µs">
|
||||
<rect class="nj-heat-3" x="317" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="354" text-anchor="middle">4.04</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select 1.44× the time of the fastest library (fully validating) way: structs (validate_skipped) twitter.json: 529 µs citm_catalog.json: 1,435 µs canada.json: 1,913 µs jeopardy.json: 91,253 µs">
|
||||
<rect class="nj-heat-1" x="409" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="354" text-anchor="middle">1.44</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · select, checking less 0.60× the time of the fastest fully validating library way: structs twitter.json: 342 µs citm_catalog.json: 410 µs canada.json: 431 µs jeopardy.json: 66,069 µs reads into structs and steps over fields it doesn't know without checking them (validate_skipped checks them too)">
|
||||
<rect class="nj-heat-0" x="455" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="348" text-anchor="middle">0.60</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="361" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · edit 4.85× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 3,525 µs citm_catalog.json: 6,551 µs canada.json: 23,644 µs jeopardy.json: 661,941 µs">
|
||||
<rect class="nj-heat-3" x="501" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="354" text-anchor="middle">4.85</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify 5.10× the time of the fastest library (fully validating) way: generic (strict) twitter.json: 3,780 µs citm_catalog.json: 6,416 µs canada.json: 23,765 µs jeopardy.json: 458,311 µs">
|
||||
<rect class="nj-heat-4" x="593" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="354" text-anchor="middle">5.10</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · minify, checking less 0.73× the time of the fastest fully validating library way: minify_json twitter.json: 422 µs citm_catalog.json: 1,144 µs canada.json: 2,350 µs jeopardy.json: 96,405 µs minify_json only removes whitespace, without parsing the values">
|
||||
<rect class="nj-heat-0" x="639" y="333" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="348" text-anchor="middle">0.73</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="361" text-anchor="middle">P</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="Glaze · write 1.84× the time of the fastest library (fully validating) twitter.json: 360 µs · generic citm_catalog.json: 660 µs · generic canada.json: 3,714 µs · generic (strict) jeopardy.json: 124,598 µs · generic">
|
||||
<rect class="nj-heat-2" x="685" y="333" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="354" text-anchor="middle">1.84</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel nj-charts-name-json" x="216" y="390" text-anchor="end">nlohmann/json json</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · validate 2.74× the time of the fastest library (fully validating) way: accept twitter.json: 677 µs citm_catalog.json: 1,433 µs canada.json: 4,584 µs jeopardy.json: 73,561 µs">
|
||||
<rect class="nj-heat-3" x="225" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="270" y="390" text-anchor="middle">2.74</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · sum 1.67× the time of the fastest library (fully validating) way: sax twitter.json: 797 µs citm_catalog.json: 1,548 µs canada.json: 6,004 µs jeopardy.json: 101,516 µs">
|
||||
<rect class="nj-heat-2" x="317" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="362" y="390" text-anchor="middle">1.67</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · select 7.24× the time of the fastest library (fully validating) way: structs (from_json) twitter.json: 3,325 µs citm_catalog.json: 5,126 µs canada.json: 11,908 µs jeopardy.json: 423,362 µs">
|
||||
<rect class="nj-heat-4" x="409" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="454" y="390" text-anchor="middle">7.24</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · edit 3.81× the time of the fastest library (fully validating) way: ordered_json twitter.json: 2,912 µs citm_catalog.json: 4,999 µs canada.json: 15,603 µs jeopardy.json: 604,744 µs">
|
||||
<rect class="nj-heat-3" x="501" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="546" y="390" text-anchor="middle">3.81</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · minify 4.79× the time of the fastest library (fully validating) way: parse + dump twitter.json: 4,143 µs citm_catalog.json: 5,702 µs canada.json: 16,463 µs jeopardy.json: 528,092 µs">
|
||||
<rect class="nj-heat-3" x="593" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="638" y="390" text-anchor="middle">4.79</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="nlohmann/json json · write 1.99× the time of the fastest library (fully validating) way: dump twitter.json: 471 µs citm_catalog.json: 644 µs canada.json: 4,344 µs jeopardy.json: 114,096 µs">
|
||||
<rect class="nj-heat-2" x="685" y="369" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="390" text-anchor="middle">1.99</text>
|
||||
</g>
|
||||
<text class="nj-charts-rowlabel " x="216" y="426" text-anchor="end">RapidJSON</text>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate 4.50× the time of the fastest library (fully validating) twitter.json: 1,552 µs · insitu (copy untimed) citm_catalog.json: 2,210 µs · insitu (copy untimed) canada.json: 4,104 µs · S​AX (string stream, default precision) jeopardy.json: 168,747 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="225" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="247.5" y="426" text-anchor="middle">4.50</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · validate, checking less 3.40× the time of the fastest fully validating library twitter.json: 1,082 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,570 µs · S​AX (default precision) (no encoding check) canada.json: 4,104 µs · S​AX (string stream, default precision) (validates fully) jeopardy.json: 110,856 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="271" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="292.5" y="420" text-anchor="middle">3.40</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="292.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum 2.98× the time of the fastest library (fully validating) twitter.json: 1,616 µs · insitu (copy untimed) citm_catalog.json: 2,290 µs · insitu (copy untimed) canada.json: 11,183 µs · S​AX (string stream) jeopardy.json: 181,500 µs · insitu (copy untimed)">
|
||||
<rect class="nj-heat-3" x="317" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="339.5" y="426" text-anchor="middle">2.98</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · sum, checking less 2.29× the time of the fastest fully validating library twitter.json: 1,130 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,743 µs · S​AX (no encoding check) canada.json: 11,109 µs · S​AX (string stream) (no encoding check) jeopardy.json: 119,706 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-2" x="363" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="384.5" y="420" text-anchor="middle">2.29</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="384.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select 3.84× the time of the fastest library (fully validating) way: insitu (copy untimed) twitter.json: 1,560 µs citm_catalog.json: 2,127 µs canada.json: 11,547 µs jeopardy.json: 176,066 µs">
|
||||
<rect class="nj-heat-3" x="409" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="431.5" y="426" text-anchor="middle">3.84</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · select, checking less 3.06× the time of the fastest fully validating library twitter.json: 1,079 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 1,817 µs · insitu (copy untimed) (no encoding check) canada.json: 11,436 µs · Document (string stream) (no encoding check) jeopardy.json: 122,354 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="455" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="476.5" y="420" text-anchor="middle">3.06</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="476.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit 2.92× the time of the fastest library (fully validating) twitter.json: 2,333 µs · insitu (copy untimed) citm_catalog.json: 3,133 µs · insitu (copy untimed) canada.json: 20,518 µs · insitu (copy) jeopardy.json: 315,892 µs · insitu (copy untimed) (copy): parses in place, on a copy of the input that is part of the time">
|
||||
<rect class="nj-heat-3" x="501" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="523.5" y="426" text-anchor="middle">2.92</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · edit, checking less 2.58× the time of the fastest fully validating library twitter.json: 1,838 µs · insitu (copy untimed) (no encoding check) citm_catalog.json: 2,836 µs · insitu (copy untimed) (no encoding check) canada.json: 20,320 µs · Document (string stream) (no encoding check) jeopardy.json: 271,888 µs · insitu (copy untimed) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it)">
|
||||
<rect class="nj-heat-3" x="547" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="568.5" y="420" text-anchor="middle">2.58</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="568.5" y="433" text-anchor="middle">U</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify 3.64× the time of the fastest library (fully validating) twitter.json: 3,015 µs · S​AX to Writer citm_catalog.json: 3,012 µs · S​AX to Writer canada.json: 21,177 µs · Document + Writer jeopardy.json: 355,727 µs · S​AX to Writer (string stream)">
|
||||
<rect class="nj-heat-3" x="593" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="615.5" y="426" text-anchor="middle">3.64</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · minify, checking less 2.64× the time of the fastest fully validating library twitter.json: 1,978 µs · S​AX to Writer (no encoding check) citm_catalog.json: 2,493 µs · S​AX to Writer (no encoding check) canada.json: 15,512 µs · S​AX to Writer (raw numbers) (no encoding check) jeopardy.json: 249,235 µs · S​AX to Writer (string stream) (no encoding check) trusts U​TF-8: RapidJSON's default (kParseValidateEncodingFlag checks it) copies each number's text instead of formatting it (kParseNumbersAsStringsFlag)">
|
||||
<rect class="nj-heat-3" x="639" y="405" width="44" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="660.5" y="420" text-anchor="middle">2.64</text>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="660.5" y="433" text-anchor="middle">U N</text>
|
||||
</g>
|
||||
<g class="nj-heat-cell" tabindex="0" data-tip="RapidJSON · write 3.11× the time of the fastest library (fully validating) way: Writer twitter.json: 717 µs citm_catalog.json: 1,033 µs canada.json: 9,017 µs jeopardy.json: 134,260 µs">
|
||||
<rect class="nj-heat-3" x="685" y="405" width="90" height="34" rx="3"/>
|
||||
<text class="nj-charts-cell" x="730" y="426" text-anchor="middle">3.11</text>
|
||||
</g>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="8" y="472">time relative to the fastest fully validating library, less is better</text>
|
||||
<g><rect class="nj-heat-0" x="8" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="46" y="496" text-anchor="middle">below 1.15</text></g>
|
||||
<g><rect class="nj-heat-1" x="88" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="126" y="496" text-anchor="middle">1.15 to 1.5</text></g>
|
||||
<g><rect class="nj-heat-2" x="168" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="206" y="496" text-anchor="middle">1.5 to 2.5</text></g>
|
||||
<g><rect class="nj-heat-3" x="248" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="286" y="496" text-anchor="middle">2.5 to 5</text></g>
|
||||
<g><rect class="nj-heat-4" x="328" y="482" width="76" height="20" rx="3"/>
|
||||
<text class="nj-charts-cell nj-charts-cell--small" x="366" y="496" text-anchor="middle">5 and more</text></g>
|
||||
<rect class="nj-heat-na" x="420" y="482" width="40" height="20" rx="3"/>
|
||||
<text class="nj-charts-tick" x="440" y="496">n/a</text>
|
||||
<text class="nj-charts-tick nj-charts-tick--l" x="468" y="496">no A​PI for it</text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 45 KiB |
@@ -58,7 +58,7 @@ Clang).
|
||||
anything, or link a library. Put the file in a directory named `nlohmann` that is on your include path (for
|
||||
example `third_party/nlohmann/json.hpp` with `-I third_party`), so that `#include <nlohmann/json.hpp>` works.
|
||||
Download the companion headers listed below only if you use them: `json_view.hpp` for the
|
||||
[zero-copy views](../features/json_view.md), `json_fwd.hpp` for forward declarations, and `json_literals.hpp` if
|
||||
[zero-copy views](../features/json_view/index.md), `json_fwd.hpp` for forward declarations, and `json_literals.hpp` if
|
||||
you define `JSON_NO_AUTOMATIC_UDLS`. Keep them in the same `nlohmann` directory.
|
||||
|
||||
Do not copy only parts of the repository's `include/` directory: the headers in it include each other and must be
|
||||
@@ -75,7 +75,7 @@ for the user-defined string literals if you define
|
||||
For the read-only, non-owning [`basic_json_document`](../api/basic_json_document/index.md)/[`basic_json_view`](../api/basic_json_view/index.md)
|
||||
types, additionally include
|
||||
[`single_include/nlohmann/json_view.hpp`](https://github.com/nlohmann/json/blob/develop/single_include/nlohmann/json_view.hpp);
|
||||
see [Zero-copy JSON views](../features/json_view.md).
|
||||
see [Zero-copy JSON views](../features/json_view/index.md).
|
||||
|
||||
## Notes for builds and distribution
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
* Marks links that leave the site with the class "nj-external", which brand.css turns into a small icon in front of
|
||||
* the link. A link is external when its host is neither the current one nor the production site. Links in the page
|
||||
* actions (edit, raw), buttons, header anchors, and links that only wrap an image (badges) are left alone.
|
||||
* actions (edit, raw), buttons, header anchors, a blog post's byline, and links that only wrap an image (badges) are
|
||||
* left alone.
|
||||
* Runs through Material's document$ (navigation.instant), so it also applies after an instant page switch.
|
||||
*/
|
||||
(function () {
|
||||
@@ -17,7 +18,7 @@
|
||||
if (a.protocol !== "http:" && a.protocol !== "https:") {
|
||||
continue;
|
||||
}
|
||||
if (a.matches(".md-button, .md-content__button, .headerlink") || a.querySelector("img, svg")) {
|
||||
if (a.matches(".md-button, .md-content__button, .headerlink, .nj-byline a") || a.querySelector("img, svg")) {
|
||||
continue;
|
||||
}
|
||||
a.classList.add("nj-external");
|
||||
|
||||
@@ -104,3 +104,72 @@
|
||||
init();
|
||||
}
|
||||
})();
|
||||
|
||||
/* figures: the tooltips of the heatmaps in home/blog/how_3_13_0_got_faster.md (perf_blog_usecases_*.svg). Each
|
||||
cell is a focusable <g data-tip>: its lines (the first one the heading) are shown on hover, keyboard focus or tap.
|
||||
Without JS, the figure's <desc> and the tables in the appendix carry the same numbers. */
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
var tip = null;
|
||||
var current = null;
|
||||
|
||||
function show(cell) {
|
||||
if (!tip) {
|
||||
tip = document.createElement("div");
|
||||
tip.className = "nj-heat-tip";
|
||||
tip.setAttribute("role", "tooltip");
|
||||
tip.hidden = true;
|
||||
document.body.appendChild(tip);
|
||||
}
|
||||
if (current) current.classList.remove("nj-heat-on");
|
||||
current = cell;
|
||||
cell.classList.add("nj-heat-on");
|
||||
var lines = (cell.getAttribute("data-tip") || "").split("\n");
|
||||
tip.textContent = "";
|
||||
lines.forEach(function (line, i) {
|
||||
var el = document.createElement(i === 0 ? "strong" : "div");
|
||||
el.textContent = line;
|
||||
tip.appendChild(el);
|
||||
});
|
||||
tip.hidden = false;
|
||||
var r = cell.getBoundingClientRect();
|
||||
var w = tip.offsetWidth, h = tip.offsetHeight;
|
||||
var x = Math.min(Math.max(8, r.left + r.width / 2 - w / 2), document.documentElement.clientWidth - w - 8);
|
||||
var y = r.bottom + 8 + h > window.innerHeight ? r.top - h - 8 : r.bottom + 8;
|
||||
tip.style.left = (x + window.scrollX) + "px";
|
||||
tip.style.top = (y + window.scrollY) + "px";
|
||||
}
|
||||
|
||||
function hide() {
|
||||
if (current) current.classList.remove("nj-heat-on");
|
||||
current = null;
|
||||
if (tip) tip.hidden = true;
|
||||
}
|
||||
|
||||
function init() {
|
||||
hide();
|
||||
Array.prototype.forEach.call(document.querySelectorAll("svg.nj-charts--heat .nj-heat-cell"), function (cell) {
|
||||
if (cell.dataset.njHeatReady) return;
|
||||
cell.dataset.njHeatReady = "1";
|
||||
cell.addEventListener("mouseenter", function () { show(cell); });
|
||||
cell.addEventListener("mouseleave", hide);
|
||||
cell.addEventListener("focus", function () { show(cell); });
|
||||
cell.addEventListener("blur", hide);
|
||||
// a tap also focuses the cell; a tap elsewhere or Escape hides the tooltip
|
||||
cell.addEventListener("click", function (ev) { ev.stopPropagation(); show(cell); });
|
||||
});
|
||||
}
|
||||
|
||||
document.addEventListener("click", hide);
|
||||
document.addEventListener("keydown", function (ev) { if (ev.key === "Escape") hide(); });
|
||||
window.addEventListener("scroll", hide, { passive: true });
|
||||
|
||||
if (typeof document$ !== "undefined" && document$ && typeof document$.subscribe === "function") {
|
||||
document$.subscribe(init);
|
||||
} else if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
})();
|
||||
@@ -1,4 +1,4 @@
|
||||
/* figures: jsonview -- stepper for the edit frames on features/json_view.md.
|
||||
/* figures: jsonview -- stepper for the edit frames on features/json_view/editing.md.
|
||||
Without JS the frames (.nj-jsonview-step) show one below the other; with JS one frame at a time, with
|
||||
previous/next and one button per step. Never advances on its own. */
|
||||
(function () {
|
||||
|
||||