text/template: improve lexer performance in finding left delimiters.
The existing implementation calls l.next for each run up to the next instance of the left delimiter ({{). For ascii text, this is multiple function calls per byte. Change to use strings.Index to find the left delimiter. The performace improvement ranges from 1:1 (no text outside of {{}}'s) to multiple times faster (9:1 was seen on 8K of text with no {{ }}'s). Change-Id: I2f82bea63b78b6714f09a725f7b2bbb00a3448a3 Reviewed-on: https://go-review.googlesource.com/24863Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Rob Pike <r@golang.org>
Showing
Please register or sign in to comment