Improved performance

This commit is contained in:
2024-03-15 00:07:44 +01:00
parent 99ad93e410
commit 8f507e4430
2 changed files with 9 additions and 12 deletions

11
Tree.go
View File

@ -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