Commit a3900cb1 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Work on pma spec and speed up key compare

git-svn-id: file:///svn/tokudb@47 c7de825b-a66e-492c-adef-691d508d4ae1
parent fc631f31
CFLAGS = -W -Wall -O2
serial.%.50K: makedata-serial
./makedata-serial $(patsubst serial.%.50K, %, $@) 50000 > $@
serial.%.300K: makedata-serial
./makedata-serial $(patsubst serial.%.300K, %, $@) 300000 > $@
random.1.300K:
./makedata-random 1000 600000 1 > random.1.300K
random.2.300K:
./makedata-random 1000 900000 2 > random.2.300K
random.9.300K:
./makedata-random 1000 3000000 9 > random.9.300K
random.19.300K:
./makedata-random 1000 6000000 19 > random.19.300K
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage # GCOV_FLAGS = -fprofile-arcs -ftest-coverage
# PROF_FLAGS = -pg # PROF_FLAGS = -pg
#OPTFLAGS = -O2 OPTFLAGS = -O2
CFLAGS = -Wall -W $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) -Werror -fPIC CFLAGS = -Wall -W $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) -Werror -fPIC
LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS)
......
...@@ -2,7 +2,24 @@ ...@@ -2,7 +2,24 @@
#include <assert.h> #include <assert.h>
#include <string.h> #include <string.h>
int keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) { int keycompare (bytevec key1b, ITEMLEN key1len, bytevec key2b, ITEMLEN key2len) {
const unsigned char *key1 = key1b;
const unsigned char *key2 = key2b;
while (key1len > 0 && key2len > 0) {
unsigned char b1 = key1[0];
unsigned char b2 = key2[0];
if (b1<b2) return -1;
if (b1>b2) return 1;
key1len--; key1++;
key2len--; key2++;
}
if (key1len<key2len) return -1;
if (key1len>key2len) return 1;
return 0;
}
#if 0
int oldkeycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) {
if (key1len==key2len) { if (key1len==key2len) {
return memcmp(key1,key2,key1len); return memcmp(key1,key2,key1len);
} else if (key1len<key2len) { } else if (key1len<key2len) {
...@@ -13,6 +30,7 @@ int keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) { ...@@ -13,6 +30,7 @@ int keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) {
return -keycompare(key2,key2len,key1,key1len); return -keycompare(key2,key2len,key1,key1len);
} }
} }
#endif
void test_keycompare (void) { void test_keycompare (void) {
assert(keycompare("a",1, "a",1)==0); assert(keycompare("a",1, "a",1)==0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment