Improved performance
This commit is contained in:
11
Tree.go
11
Tree.go
@ -136,13 +136,7 @@ begin:
|
||||
offset = i
|
||||
i++
|
||||
|
||||
for {
|
||||
// We reached the end.
|
||||
if i == uint(len(path)) {
|
||||
addParameter(node.prefix, path[offset:i])
|
||||
return node.data
|
||||
}
|
||||
|
||||
for i < uint(len(path)) {
|
||||
// node: /:id|/posts
|
||||
// path: /123|/posts
|
||||
if path[i] == separator {
|
||||
@ -156,6 +150,9 @@ begin:
|
||||
|
||||
i++
|
||||
}
|
||||
|
||||
addParameter(node.prefix, path[offset:i])
|
||||
return node.data
|
||||
}
|
||||
|
||||
// node: /|*any
|
||||
|
Reference in New Issue
Block a user