From 0fd6c150e806d036a858662b81bb52a86b6e6281 Mon Sep 17 00:00:00 2001 From: siddontang Date: Mon, 7 Jul 2014 15:36:45 +0800 Subject: [PATCH] Optimize memory copy --- ledis/t_hash.go | 2 +- ledis/t_zset.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ledis/t_hash.go b/ledis/t_hash.go index 9fcbcee..c3f6f42 100644 --- a/ledis/t_hash.go +++ b/ledis/t_hash.go @@ -273,7 +273,7 @@ func (db *DB) HDel(key []byte, args ...[]byte) (int64, error) { ek = db.hEncodeHashKey(key, args[i]) - v = it.Find(ek) + v = it.RawFind(ek) if v == nil { continue } else { diff --git a/ledis/t_zset.go b/ledis/t_zset.go index f32f67d..d3e14e6 100644 --- a/ledis/t_zset.go +++ b/ledis/t_zset.go @@ -477,7 +477,7 @@ func (db *DB) zrank(key []byte, member []byte, reverse bool) (int64, error) { for ; it.Valid(); it.Next() { n++ - lastKey = it.Key() + lastKey = it.BufKey(lastKey) } it.Close() @@ -511,7 +511,7 @@ func (db *DB) zRemRange(t *tx, key []byte, min int64, max int64, offset int, cou it := db.zIterator(key, min, max, offset, count, false) var num int64 = 0 for ; it.Valid(); it.Next() { - sk := it.Key() + sk := it.RawKey() _, m, _, err := db.zDecodeScoreKey(sk) if err != nil { continue