Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Features] Integrating ART #29

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ add_library(bliss OBJECT
${CMAKE_SOURCE_DIR}/src/bliss/bench_lipp.h
${CMAKE_SOURCE_DIR}/src/bliss/bench_alex.h
${CMAKE_SOURCE_DIR}/src/bliss/bench_btree.h
${CMAKE_SOURCE_DIR}/src/bliss/bench_ART.h
${CMAKE_SOURCE_DIR}/src/bliss/bench_art.h
)

target_compile_features(bliss PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion script/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from infra.pybliss import BlissArgs, PyBliss
from infra.util import get_file_params

INDEXES = ["btree", "radix_tree", "ART"]
INDEXES = ["btree", "art"]
PRELOAD_FACTOR = 0.4
WRITE_FACTOR = 0.4
READ_FACTOR = 0.2
Expand Down
1 change: 0 additions & 1 deletion script/infra/pybliss.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def run_single_bliss_bench(self, args: BlissArgs) -> BlissStats:
f"--file_type {'binary' if args.file_type else 'txt'}",
"--use_preload" if args.use_preload else "",
]
print("this is cmd: " , " ".join(cmd))
process = subprocess.Popen(
" ".join(cmd),
stdout=subprocess.PIPE,
Expand Down
14 changes: 9 additions & 5 deletions src/bliss/bench_ART.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef BLISS_BENCH_ART
#define BLISS_BENCH_ART

#include <ART.h>
#include "ART.h"

#include <vector>

Expand All @@ -14,6 +14,7 @@ namespace bliss {
template <typename KEY_TYPE, typename VALUE_TYPE>
class BlissARTIndex : public BlissIndex<KEY_TYPE, VALUE_TYPE> {
public:
static constexpr size_t KEY_SIZE = sizeof(KEY_TYPE);
ART::Node* _index;
BlissARTIndex() {
_index = nullptr;
Expand All @@ -28,17 +29,20 @@ class BlissARTIndex : public BlissIndex<KEY_TYPE, VALUE_TYPE> {
}

bool get(KEY_TYPE key) override {
uint8_t ARTkey[8];
uint8_t ARTkey[KEY_SIZE];
ART::loadKey(key, ARTkey);

ART::Node* leaf = ART::lookup(_index, ARTkey, 8, 0, 8);
uint8_t depth = 0;
ART::Node* leaf = ART::lookup(_index, ARTkey, KEY_SIZE, depth, KEY_SIZE);
return ART::isLeaf(leaf) && ART::getLeafValue(leaf) == key;
}

void put(KEY_TYPE key, VALUE_TYPE value) override {
uint8_t ARTkey[8];
uint8_t ARTkey[KEY_SIZE];
ART::loadKey(key, ARTkey);
ART::insert(_index, &_index, ARTkey, 0, key, 8);

uint8_t depth = 0;
ART::insert(_index, &_index, ARTkey, depth, key, KEY_SIZE);
JslYoon marked this conversation as resolved.
Show resolved Hide resolved
}

void end_routine() override {}
Expand Down
9 changes: 4 additions & 5 deletions src/bliss_bench.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <alex.h>
#include <lipp.h>
#include <ART.h>
#include "ART.h"
#include <spdlog/common.h>

#include <cxxopts.hpp>
Expand All @@ -10,8 +10,7 @@
#include "bliss/bench_alex.h"
#include "bliss/bench_btree.h"
#include "bliss/bench_lipp.h"
#include "bliss/bench_ART.h"

#include "bliss/bench_art.h"
#include "bliss/bliss_index.h"
#include "bliss/util/reader.h"
#include "bliss/util/timer.h"
Expand Down Expand Up @@ -52,7 +51,7 @@ BlissConfig parse_args(int argc, char *argv[]) {
cxxopts::value<int>()->default_value("0"))(
"v,verbosity", "Verbosity [0: Info| 1: Debug | 2: Trace]",
cxxopts::value<int>()->default_value("0")->implicit_value("1"))(
"i,index", "Index type [alex | lipp | btree | bepstree | lsm | ART]",
"i,index", "Index type [alex | lipp | btree | bepstree | lsm | art]",
cxxopts::value<std::string>()->default_value("btree"))(
"file_type", "Input file type [binary | txt]",
cxxopts::value<std::string>()->default_value("txt"))(
Expand Down Expand Up @@ -269,7 +268,7 @@ int main(int argc, char *argv[]) {
index.reset(new bliss::BlissLippIndex<key_type, value_type>());
} else if (config.index == "btree") {
index.reset(new bliss::BlissBTreeIndex<key_type, value_type>());
} else if (config.index == "ART") {
} else if (config.index == "art") {
index.reset(new bliss::BlissARTIndex<key_type, value_type>());
} else {
spdlog::error("{} not implemented yet", config.index);
Expand Down