From 41d2b035e2387dcfbf5b268ffb3da446b28186ff Mon Sep 17 00:00:00 2001 From: Fredrik Medley Date: Fri, 12 Jun 2015 23:59:12 +0200 Subject: Optimize StringPiece hash map Replace strncmp with memcmp to improve performance. Signed-off-by: Fredrik Medley --- src/hash_map.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hash_map.h b/src/hash_map.h index abdba92..a91aeb9 100644 --- a/src/hash_map.h +++ b/src/hash_map.h @@ -76,7 +76,7 @@ struct StringPieceCmp : public hash_compare { return MurmurHash2(key.str_, key.len_); } bool operator()(const StringPiece& a, const StringPiece& b) const { - int cmp = strncmp(a.str_, b.str_, min(a.len_, b.len_)); + int cmp = memcmp(a.str_, b.str_, min(a.len_, b.len_)); if (cmp < 0) { return true; } else if (cmp > 0) { -- cgit v1.2.1