commit | 2300fd46f7162c6f59e848ff28e60571ea2061ca | [log] [tgz] |
---|---|---|
author | Dustin Sallings <dustin@spy.net> | Thu May 23 01:40:31 2013 -0700 |
committer | Dustin Sallings <dustin@spy.net> | Thu May 23 01:40:31 2013 -0700 |
tree | e745f01de94daec0aca3ea39ff9136bf0d2a30f2 | |
parent | b718ef0aa37e0777bb7c2fd79e39f1afbbb5fc71 [diff] |
Replacing make with a direct buffer is faster. This was a bit surprising, but seriously... Before: BenchmarkCommas 1000000 2974 ns/op After: BenchmarkCommas 1000000 2446 ns/op
diff --git a/comma.go b/comma.go index ceba762..26666e1 100644 --- a/comma.go +++ b/comma.go
@@ -13,7 +13,7 @@ v = 0 - v } - parts := make([]string, 9) + parts := []string{"", "", "", "", "", "", "", "", ""} j := len(parts) - 1 for v > 999 {