Improved performance
This commit is contained in:
parent
b04aadea09
commit
e348332fa9
2 changed files with 9 additions and 12 deletions
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue