Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2023-02-08 17:23:07


Ruben Perez wrote:
> This yielded the following results on allocations:
>
> section | total bytes | total allocations
> -------------------------------------------------
> init | 1550 | 31
> renderer_ctor | 1582 | 32
> parsing | 1900 | 39
>
> I was surprised by the number of allocations that the actual parsing does. Is
> this because renderer::render_some must assume that the input buffer may
> not outlive the actual parsing?

I haven't optimized for number of allocations, my focus was on correctness.
In this specific case I would guess these are due to the temporary saving and
restoring the delimiters on each partial invocation. Since json::string doesn't
use SBO to keep sizeof small, these go to the allocator.

To avoid this I'll need to write my own string or maybe switch to
std::pmr::string except using my own polymorphic_allocator.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk