summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-05-21 19:06:05 +0200
committerDimitri Sokolyuk <demon@dim13.org>2017-05-21 19:06:05 +0200
commit3fcdb3965eba9353cf64f2ce042475726ad717d7 (patch)
treeda8e5d2d235c538cb3ddc3a8cf613099edcacba6
parentc85c3bab7fc316293f284b5553ede4dd8c88b724 (diff)
Preallocate
-rw-r--r--format.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/format.go b/format.go
index 0758da8..4369314 100644
--- a/format.go
+++ b/format.go
@@ -5,7 +5,8 @@ import (
"strings"
)
-func split(s string, n int) (ret []string) {
+func split(s string, n int) []string {
+ ret := make([]string, 0, len(s)/n+1)
var pos int
if rest := len(s) % n; rest > 0 {
ret = append(ret, s[:rest])