mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 11:17:13 +00:00
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>