internal/core/adt: use strings.Builder for interpolations
The vast majority of interpolations are in string literals,
not in bytes literals, so avoid an allocation in the string case
by using a strings.Builder. This moves the extra allocation to
the bytes case, but that's fine as they are not as common.
│ old │ new │
│ B/op │ B/op vs base │
VetInventory 3.560Gi ± 0% 3.548Gi ± ∞ ¹ -0.33% (p=0.222 n=8+1)
│ old │ new │
│ allocs/op │ allocs/op vs base │
VetInventory 31.69M ± 0% 31.59M ± ∞ ¹ -0.33% (p=0.222 n=8+1)
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I701f3f724151bc2491838275a2cf961476833ca4
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1234030
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>