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: I231225c61e667535e2ce55cd2facea6d279cc59d Reviewed-on: https://go-review.googlesource.com/33234 Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Showing
This diff is collapsed.
Please register or sign in to comment