Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text/template: line number tracking is O(N^2) #17851

Closed
bradfitz opened this issue Nov 8, 2016 · 3 comments
Closed

text/template: line number tracking is O(N^2) #17851

bradfitz opened this issue Nov 8, 2016 · 3 comments
Assignees
Milestone

Comments

@bradfitz
Copy link
Contributor

@bradfitz bradfitz commented Nov 8, 2016

Per the golang-dev thread, the text/template line tracking is O(N^2):

// lineNumber reports which line we're on, based on the position of
// the previous item returned by nextItem. Doing it this way
// means we don't have to worry about peek double counting.
func (l *lexer) lineNumber() int {
	return 1 + strings.Count(l.input[:l.lastPos], "\n")
}

Tracking bug for @robpike.

@bradfitz bradfitz added this to the Go1.8 milestone Nov 8, 2016
@quentinmit quentinmit added the NeedsFix label Nov 8, 2016
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 8, 2016

CL https://golang.org/cl/32923 mentions this issue.

@gopherbot gopherbot closed this in 794fb71 Nov 14, 2016
@bradfitz
Copy link
Contributor Author

@bradfitz bradfitz commented Nov 14, 2016

The CL broke the build so I reverted it. (it had data races)

Reopening this.

@bradfitz bradfitz reopened this Nov 14, 2016
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 14, 2016

CL https://golang.org/cl/33234 mentions this issue.

@gopherbot gopherbot closed this in 24a088d Nov 15, 2016
@golang golang locked and limited conversation to collaborators Nov 15, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.