• Martin Möhrmann's avatar
    fmt: use fewer allocations for %q string formatting · 5763476f
    Martin Möhrmann authored
    Reuse the internal buffer and use append versions of
    the strconv quote functions to avoid some allocations.
    
    Add more tests.
    
    name                  old time/op    new time/op    delta
    SprintfQuoteString-2     486ns ± 2%     416ns ± 2%  -14.42%  (p=0.000 n=20+20)
    
    name                  old allocs/op  new allocs/op  delta
    SprintfQuoteString-2      4.00 ± 0%      2.00 ± 0%  -50.00%  (p=0.000 n=20+20)
    
    Change-Id: I63795b51fd95c53c5993ec8e6e99b659941f9f54
    Reviewed-on: https://go-review.googlesource.com/20251
    Run-TryBot: Rob Pike <r@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRob Pike <r@golang.org>
    5763476f
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...