mirror of
https://github.com/redis/go-redis.git
synced 2025-07-18 00:20:57 +03:00
perf: reduce unnecessary memory allocation (#3399)
Signed-off-by: fukua95 <fukua95@gmail.com> Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
This commit is contained in:
@ -257,16 +257,15 @@ func (c cmdable) ZInterWithScores(ctx context.Context, store *ZStore) *ZSliceCmd
|
||||
}
|
||||
|
||||
func (c cmdable) ZInterCard(ctx context.Context, limit int64, keys ...string) *IntCmd {
|
||||
args := make([]interface{}, 4+len(keys))
|
||||
numKeys := len(keys)
|
||||
args := make([]interface{}, 4+numKeys)
|
||||
args[0] = "zintercard"
|
||||
numkeys := int64(0)
|
||||
args[1] = numKeys
|
||||
for i, key := range keys {
|
||||
args[2+i] = key
|
||||
numkeys++
|
||||
}
|
||||
args[1] = numkeys
|
||||
args[2+numkeys] = "limit"
|
||||
args[3+numkeys] = limit
|
||||
args[2+numKeys] = "limit"
|
||||
args[3+numKeys] = limit
|
||||
cmd := NewIntCmd(ctx, args...)
|
||||
_ = c(ctx, cmd)
|
||||
return cmd
|
||||
|
Reference in New Issue
Block a user