Small optimizations.
This commit is contained in:
parent
73d7e4823c
commit
65e02fa87d
2 changed files with 22 additions and 10 deletions
12
qrm/utill.go
12
qrm/utill.go
|
|
@ -360,8 +360,20 @@ func cloneBytes(b []byte) []byte {
|
|||
|
||||
func concat(stringList ...string) string {
|
||||
var b strings.Builder
|
||||
b.Grow(length(stringList))
|
||||
|
||||
for _, str := range stringList {
|
||||
b.WriteString(str)
|
||||
}
|
||||
return b.String()
|
||||
}
|
||||
|
||||
func length(strings []string) int {
|
||||
var ret int
|
||||
|
||||
for i := 0; i < len(strings); i++ {
|
||||
ret += len(strings[i])
|
||||
}
|
||||
|
||||
return ret
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue