Every element of an array or object went through dump_internal(), whose
frame holds the state for descending into a container (callee-saved
registers, indentation, depth). A scalar, which is what most elements
are, needs none of it, and paid for the entry and exit regardless.
The loops now call dump_scalar() directly for anything that is not an
object or an array, and dump_internal() for those only.
Apple M1, Apple clang, retired instructions per dump(), on top of the
previous change:
small object 2997 -> 2712 (-10 %) signed_ints 276M -> 252M (-9 %)
floats 323M -> 301M (-7 %) jeopardy 501M -> 462M (-8 %)
citm_catalog 5.96M -> 5.61M (-6 %) twitter 4.40M -> 4.12M (-6 %)
canada 39.2M -> 37.0M (-5 %)
Signed-off-by: Niels Lohmann <mail@nlohmann.me>