text/template: efficient reporting of line numbers
Instead of scanning the text to count newlines, which is n², keep track as we go and store the line number in the token. benchmark old ns/op new ns/op delta BenchmarkParseLarge-4 1589721293 38783310 -97.56% Fixes #17851 Change-Id: Ieaf89a35e371b405ad92e38baa1e3fa98d18cfb4 Reviewed-on: https://go-review.googlesource.com/32923Reviewed-by: Robert Griesemer <gri@golang.org>
Showing
This diff is collapsed.