提交 0c91b183 作者: Steven Allen

bitswap: preallocate cid string array

License: MIT
Signed-off-by: 's avatarSteven Allen <steven@stebalien.com>
上级 a5894703
...@@ -73,7 +73,7 @@ func (ps *impl) Subscribe(ctx context.Context, keys ...*cid.Cid) <-chan blocks.B ...@@ -73,7 +73,7 @@ func (ps *impl) Subscribe(ctx context.Context, keys ...*cid.Cid) <-chan blocks.B
} }
func toStrings(keys []*cid.Cid) []string { func toStrings(keys []*cid.Cid) []string {
strs := make([]string, 0) strs := make([]string, 0, len(keys))
for _, key := range keys { for _, key := range keys {
strs = append(strs, key.KeyString()) strs = append(strs, key.KeyString())
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论