1
0
mirror of https://github.com/golang/go synced 2024-11-18 02:14:45 -07:00
go/src/text
Ariel Mashraki debbb1e78d text/template/parse: speed up nodes printing
This CL is a follow up for 198080.
Added a private writeTo method to the Node interface,
in order to use the same builder for printing all nodes
in the tree. Benchmark output against master:

benchmark                     old ns/op     new ns/op     delta
BenchmarkParseLarge-8         24594994      25292054      +2.83%
BenchmarkVariableString-8     117           118           +0.85%
BenchmarkListString-8         10475         3353          -67.99%

benchmark                     old allocs     new allocs     delta
BenchmarkVariableString-8     3              3              +0.00%
BenchmarkListString-8         149            31             -79.19%

benchmark                     old bytes     new bytes     delta
BenchmarkVariableString-8     72            72            +0.00%
BenchmarkListString-8         5698          1608          -71.78%

Change-Id: I2b1cf07cda65c1b80083fb99671289423700feba
Reviewed-on: https://go-review.googlesource.com/c/go/+/198278
Reviewed-by: Rob Pike <r@golang.org>
Run-TryBot: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2019-10-03 00:16:28 +00:00
..
scanner text/scanner: remove AllowDigitSeparator flag again 2019-06-27 21:13:53 +00:00
tabwriter all: remove a few unused parameters 2019-04-29 13:31:54 +00:00
template text/template/parse: speed up nodes printing 2019-10-03 00:16:28 +00:00