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
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

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 The path to resolution is known, but the work has not been done. label Nov 8, 2016
@gopherbot
Copy link

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

@bradfitz
Copy link
Contributor Author

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

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

@golang golang locked and limited conversation to collaborators Nov 15, 2017
@rsc rsc unassigned robpike Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants