Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
9921b83c
Commit
9921b83c
authored
Aug 13, 2007
by
Bradley C. Kuszmaul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Maybe faster key compare?
git-svn-id:
file:///svn/tokudb@121
c7de825b-a66e-492c-adef-691d508d4ae1
parent
7b2ef977
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
1 deletion
+18
-1
newbrt/key.c
newbrt/key.c
+18
-1
No files found.
newbrt/key.c
View file @
9921b83c
...
...
@@ -2,6 +2,7 @@
#include <assert.h>
#include <string.h>
#if 0
int keycompare (bytevec key1b, ITEMLEN key1len, bytevec key2b, ITEMLEN key2len) {
const unsigned char *key1 = key1b;
const unsigned char *key2 = key2b;
...
...
@@ -18,8 +19,9 @@ int keycompare (bytevec key1b, ITEMLEN key1len, bytevec key2b, ITEMLEN key2len)
return 0;
}
#else
#if 0
int
old
keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) {
int keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len) {
if (key1len==key2len) {
return memcmp(key1,key2,key1len);
} else if (key1len<key2len) {
...
...
@@ -30,6 +32,21 @@ int oldkeycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len)
return -keycompare(key2,key2len,key1,key1len);
}
}
#else
int
keycompare
(
bytevec
key1
,
ITEMLEN
key1len
,
bytevec
key2
,
ITEMLEN
key2len
)
{
if
(
key1len
==
key2len
)
{
return
memcmp
(
key1
,
key2
,
key1len
);
}
else
if
(
key1len
<
key2len
)
{
int
r
=
memcmp
(
key1
,
key2
,
key1len
);
if
(
r
<=
0
)
return
-
1
;
/* If the keys are the same up to 1's length, then return -1, since key1 is shorter than key2. */
else
return
1
;
}
else
{
int
r
=
memcmp
(
key1
,
key2
,
key2len
);
if
(
r
>=
0
)
return
1
;
/* If the keys are the same up to 2's length, then return 1 since key1 is longer than key2 */
else
return
-
1
;
}
}
#endif
#endif
void
test_keycompare
(
void
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment