mirror of
https://github.com/nlohmann/json.git
synced 2026-10-18 20:18:12 +00:00
Time copies together with their destruction in the benchmarks
Copy timed only the copy and destroyed it with the timer paused, and Destroy did the reverse. How a document is freed shapes the heap the next copy allocates from: since the faster destruction (#5762/#5767), part of its saved work shows up in the next copy's allocations. Copy therefore looked up to 40% slower than 3.12.0 on glibc although copying and destroying together got 1.1-1.5x faster. Copy now times a temporary copy including its destruction. CopyAssign assigns over an earlier copy, and CopyRing replaces the oldest of eight live copies. The old benchmarks remain as CopyOnly and DestroyOnly, with a note that they tell the halves apart but do not compare versions. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+70
-8
No files matched your search
@@ -17,7 +17,9 @@ Micro-benchmarks for parsing, serialization and the binary formats, written with
|
||||
| `FromBinaryShape` | read deeply nested, container-heavy and scalar-heavy documents in every binary format |
|
||||
| `FromCborChunkedString` | read CBOR strings split into indefinite-length chunks |
|
||||
| `SaxParse` | parse with a SAX handler that only counts events, so no values are built |
|
||||
| `Copy`, `Destroy`, `Equal`, `Iterate` | copy, destroy, or compare a parsed document, or visit every value with range-based `for` loops |
|
||||
| `Copy`, `CopyAssign`, `CopyRing` | copy a parsed document and destroy a copy, both timed: a temporary copy, an assignment over an earlier copy, and replacing the oldest of eight live copies |
|
||||
| `CopyOnly`, `DestroyOnly` | only the copy or only the destruction, the other half untimed; a fast destructor can leave work to the next allocations, so these tell the halves apart but do not compare versions |
|
||||
| `Equal`, `Iterate` | compare a parsed document with a copy, or visit every value with range-based `for` loops |
|
||||
| `Flatten`, `FlattenOrdered`, `Unflatten` | `flatten()` for `json` and `ordered_json`, and `unflatten()` |
|
||||
| `Diff`, `Patch` | `diff()` against the document with every eighth scalar changed, and applying that patch |
|
||||
| `JsonPointerParse`, `JsonPointerToString`, `JsonPointerAt`, `JsonPointerContains` | the JSON pointers of every scalar in a document: parse them from strings, turn them back into strings, look them up with `at()` and `contains()` |
|
||||
|
||||
Reference in new issue
Block a user