Skip to content

Commit 8292bfe

Browse files
committed
Simplifying the code, removing unnecessary (obsolete) dependencies. Killing dead code.
1 parent 3577124 commit 8292bfe

16 files changed

+46
-860
lines changed

README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,26 @@
11
# xorfilter_cpp
2-
Bloom filter alternative (C++)
2+
Xor Filters: Faster and Smaller Than Bloom and Cuckoo Filters (C++)
3+
4+
## Prerequisites
5+
6+
- A C++11 compiler such as GNU G++ or LLVM Clang++
7+
- Make
8+
9+
10+
11+
## Usage
12+
13+
```
14+
cd benchmarks
15+
make
16+
./bulk-insert-and-query.exe 10000000
17+
```
18+
19+
20+
## Where is your code?
21+
22+
See src/xorfilter.h. This single header depends on src/hashutil.h.
23+
24+
## Credit
25+
26+
The code is derived from https://github.com/efficient/cuckoofilter by Bin Fan et al.

benchmarks/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
OPT = -O3 -DNDEBUG
33
#OPT = -g -ggdb
44

5-
CXXFLAGS += -fno-strict-aliasing -Wall -std=c++11 -I. -I../src/ $(OPT) -march=core-avx2
5+
CXXFLAGS += -fno-strict-aliasing -Wall -std=c++11 -I. -I../src/ $(OPT) -march=native
66

7-
LDFLAGS+= -Wall -lpthread -lssl -lcrypto
7+
LDFLAGS = -Wall
88

99
HEADERS = $(wildcard ../src/*.h) *.h
1010

11-
SRC = ../src/hashutil.cc
11+
1212

1313
.PHONY: all
1414

@@ -19,5 +19,5 @@ all: $(BINS)
1919
clean:
2020
/bin/rm -f $(BINS)
2121

22-
%.exe: %.cc ${HEADERS} ${SRC} Makefile
23-
$(CXX) $(CXXFLAGS) $< -o $@ $(SRC) $(LDFLAGS)
22+
%.exe: %.cc ${HEADERS} Makefile
23+
$(CXX) $(CXXFLAGS) $< -o $@ $(LDFLAGS)

benchmarks/bulk-insert-and-query.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#endif
4242

4343
using namespace std;
44-
44+
using namespace hashing;
4545
using namespace cuckoofilter;
4646
using namespace xorfilter;
4747
using namespace xorfilter2;

src/bloom.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
#include <assert.h>
55
#include <algorithm>
66

7-
#include "debug.h"
87
#include "hashutil.h"
9-
#include "printutil.h"
108

119
using namespace std;
12-
using namespace cuckoofilter;
10+
using namespace hashing;
1311

1412
namespace bloomfilter {
1513
// status returned by a Bloom filter operation

src/cuckoofilter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const size_t kMaxCuckooCount = 500;
3131
// PackedTable to enable semi-sorting
3232
template <typename ItemType, size_t bits_per_item,
3333
template <size_t> class TableType = SingleTable,
34-
typename HashFamily = TwoIndependentMultiplyShift>
34+
typename HashFamily = hashing::TwoIndependentMultiplyShift>
3535
class CuckooFilter {
3636
// Storage of items
3737
TableType<bits_per_item> *table_;

src/cuckoofilter_stable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ inline uint32_t reduce(uint64_t hash, uint32_t n) {
2626
// PackedTable to enable semi-sorting
2727
template <typename ItemType, size_t bits_per_item,
2828
template <size_t> class TableType = SingleTable,
29-
typename HashFamily = TwoIndependentMultiplyShift>
29+
typename HashFamily = hashing::TwoIndependentMultiplyShift>
3030
class CuckooFilterStable {
3131
// Storage of items
3232
TableType<bits_per_item> *table_;

src/gcs.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@
44
#include <assert.h>
55
#include <algorithm>
66

7-
#include "debug.h"
87
#include "hashutil.h"
9-
#include "printutil.h"
108

119
using namespace std;
12-
using namespace cuckoofilter;
10+
using namespace hashing;
1311

1412
namespace gcsfilter {
1513
// status returned by a gcs filter operation

src/gqf_cpp.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
#include <assert.h>
55
#include <algorithm>
66

7-
#include "debug.h"
87
#include "hashutil.h"
9-
#include "printutil.h"
108

119
#include "gqf_hashutil.h"
1210
#include "gqf_hashutil.c"
@@ -15,7 +13,7 @@
1513
#include "gqf.c"
1614

1715
using namespace std;
18-
using namespace cuckoofilter;
16+
using namespace hashing;
1917

2018
namespace gqfilter {
2119
// status returned by a GQ filter operation

0 commit comments

Comments
 (0)