Commit bd237439 authored by Philipp Götze's avatar Philipp Götze
Browse files

Adapted TableInfo and improved benchmarks a bit

parent 3717f05d
......@@ -7,10 +7,10 @@ Please see the file [COPYING](COPYING) for license information.
### TODOs:
- [ ] Tests
- [ ] Get rid of expensive transactions
- [ ] Improve benchmarks
- [x] Improve benchmarks
- [ ] Describe usage
### Installation ###
For emulating a persistent memory device and further information see [http://pmem.io](http://pmem.io/2016/02/22/pm-emulation.html).
We use the C++17 standard, thus, you need a very recent C++ compiler and CMake (3.2 or newer) build environment.
......@@ -29,4 +29,4 @@ make test
### Usage ###
TODO
The test cases and benchmarks use the directory _/mnt/pmem/test_ for storing data. Thus, make sure the pmem device is mounted at _/mnt/pmem_ and the subfolder _test_ has write permissions for everybody. Alternatively, you can change the directory in [common.h](src/bench/common.h).
......@@ -43,7 +43,7 @@ if (BUILD_BENCHMARKS)
endif()
# C++ compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-deprecated -g -O0 -Wsign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-deprecated -g -O2 -Wsign-compare")
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs -Wno-#pragma-messages")
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
......@@ -108,7 +108,6 @@ include_directories("${PROJECT_SOURCE_DIR}")
include_directories("${THIRD_PARTY_DIR}")
set(core_sources
core/TableInfo.cpp
core/PTableInfo.cpp
${THIRD_PARTY_DIR}/fmt
${THIRD_PARTY_DIR}/catch
......
......@@ -54,7 +54,8 @@ using ColumnRangeMap = std::unordered_map<uint16_t, std::pair<IntDoubleString, I
template<class Tuple, typename KeyType>
class PTable {
static const auto BRANCHKEYS = ((TARGET_INDEX_NODE_SIZE - 28) / (sizeof(KeyType) + 24)) & ~1;
static const auto LEAFKEYS = ((TARGET_INDEX_NODE_SIZE - 36) / (sizeof(KeyType) + sizeof(PTuple<Tuple, KeyType>))) & ~1;
static const auto
LEAFKEYS = ((TARGET_INDEX_NODE_SIZE - 36) / (sizeof(KeyType) + sizeof(PTuple<Tuple, KeyType>))) & ~1;
using ColumnIntMap = std::map<uint16_t, uint16_t>;
using IndexType = PBPTree<KeyType, PTuple<Tuple, KeyType>, BRANCHKEYS, LEAFKEYS>;
......@@ -155,15 +156,15 @@ class PTable {
reinterpret_cast<const uint16_t &>((*currentNode)->block.get_ro()[gDataOffsetPos + idx * gAttrOffsetSize]);
uint16_t dataOffset;
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
dataOffset = dataPos + (currentPos - 1) * sizeof(int);
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
dataOffset = dataPos + (currentPos - 1) * sizeof(double);
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
dataOffset = reinterpret_cast<const uint16_t &>((*currentNode)->block.get_ro()[dataPos
+ (currentPos - 1) * gOffsetSize]);
}
......@@ -268,7 +269,7 @@ class PTable {
/************************************************************************//**
* \brief Constructor for a given schema (using TableInfo) and dimension clustering.
***************************************************************************/
PTable(const TableInfo &tInfo, const Dimensions &_bdccInfo = Dimensions()) {
PTable(const VTableInfo &tInfo, const Dimensions &_bdccInfo = Dimensions()) {
auto pop = pool_by_vptr(this);
transaction::exec_tx(pop, [&] { init(tInfo, _bdccInfo); });
}
......@@ -517,7 +518,7 @@ class PTable {
const auto &dataPos = reinterpret_cast<const uint16_t &>(b[gDataOffsetPos + idx * gAttrOffsetSize]);
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
const auto &smaMin = reinterpret_cast<const int &>(b[smaPos]);
const auto &smaMax = reinterpret_cast<const int &>(b[smaPos + sizeof(int)]);
const auto &data = reinterpret_cast<const int (&)[cnt]>(b[dataPos]);
......@@ -542,7 +543,7 @@ class PTable {
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
const auto &smaMin = reinterpret_cast<const double &>(b[smaPos]);
const auto &smaMax = reinterpret_cast<const double &>(b[smaPos + sizeof(double)]);
const auto &data = reinterpret_cast<const double (&)[cnt]>(b[dataPos]);
......@@ -567,7 +568,7 @@ class PTable {
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
auto &smaMinPos = (uint16_t &) b[smaPos];
auto &smaMaxPos = (uint16_t &) b[smaPos + gOffsetSize];
auto &stringPos = (uint16_t (&)[cnt]) b[dataPos];
......@@ -632,11 +633,11 @@ class PTable {
const auto &c = root->tInfo->columnInfo(i);
if (customizations.find(i) == customizations.end()) {
switch (c.getType()) {
case ColumnInfo::Int_Type:portions += 1;
case Int_Type:portions += 1;
break;
case ColumnInfo::Double_Type:portions += 2;
case Double_Type:portions += 2;
break;
case ColumnInfo::String_Type:portions += 4;
case String_Type:portions += 4;
break;
default:throw PTableException("unsupported column type\n");
}
......@@ -648,11 +649,11 @@ class PTable {
const auto &c = root->tInfo->columnInfo(i);
if (customizations.find(i) == customizations.end()) {
switch (c.getType()) {
case ColumnInfo::Int_Type:miniPageSizes[i] = 1 * totalSize / portions;
case Int_Type:miniPageSizes[i] = 1 * totalSize / portions;
break;
case ColumnInfo::Double_Type:miniPageSizes[i] = 2 * totalSize / portions;
case Double_Type:miniPageSizes[i] = 2 * totalSize / portions;
break;
case ColumnInfo::String_Type:miniPageSizes[i] = 4 * totalSize / portions;
case String_Type:miniPageSizes[i] = 4 * totalSize / portions;
break;
default:throw PTableException("unsupported column type\n");
}
......@@ -689,7 +690,7 @@ class PTable {
* \param[in] _bdccInfo
* a mapping of column ids to number of BDCC bits to use
***************************************************************************/
void init(const TableInfo &_tInfo, const Dimensions &_bdccInfo) {
void init(const VTableInfo &_tInfo, const Dimensions &_bdccInfo) {
this->root = make_persistent<struct root>();
this->root->tInfo = make_persistent<PTableInfo>(_tInfo);
this->root->bdccInfo = make_persistent<BDCCInfo>(_bdccInfo);
......@@ -725,17 +726,17 @@ class PTable {
uint16_t smaOffset = currentOffset;
uint16_t dataOffset;
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
dataOffset = smaOffset + 2 * sizeof(int);
smaSize += 2 * sizeof(int);
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
dataOffset = smaOffset + 2 * sizeof(double);
smaSize += 2 * sizeof(double);
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
dataOffset = smaOffset + gAttrOffsetSize;
smaSize += gAttrOffsetSize;
}
......@@ -785,7 +786,7 @@ class PTable {
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
/* Get Record Value */
auto iterBegin = buf.cbegin() + recordOffset;
auto iterEnd = iterBegin + sizeof(int);
......@@ -809,7 +810,7 @@ class PTable {
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
/* Get Record Value */
auto iterBegin = buf.cbegin() + recordOffset;
auto iterEnd = iterBegin + sizeof(double);
......@@ -833,7 +834,7 @@ class PTable {
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
/* Get Record Value */
auto iterBegin = buf.cbegin() + recordOffset;
const auto value = deserialize<std::string>(iterBegin, buf.end());
......@@ -941,15 +942,15 @@ class PTable {
const auto &dataPos =
reinterpret_cast<const uint16_t &>(block0[gDataOffsetPos + attributeIdx * gAttrOffsetSize]);
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
pTupleOffsets[attributeIdx] = dataPos + tuplePos * sizeof(int);
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
pTupleOffsets[attributeIdx] = dataPos + tuplePos * sizeof(double);
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
pTupleOffsets[attributeIdx] =
reinterpret_cast<const uint16_t &>(block0[dataPos + tuplePos * gOffsetSize]);
}
......@@ -1034,7 +1035,7 @@ class PTable {
for (const auto &p: predicates) {
const auto &smaPos = reinterpret_cast<const uint16_t &>(b.get_ro()[gSmaOffsetPos + p.first * gAttrOffsetSize]);
switch (tInfo.columnInfo(p.first).getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
const auto &smaMin = reinterpret_cast<const int &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const int &>(b.get_ro()[smaPos + sizeof(int)]);
PLOG("predicate range: " << std::get<int>(p.second.first) << '-'
......@@ -1046,7 +1047,7 @@ class PTable {
}
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
const auto &smaMin = reinterpret_cast<const double &>(b.get_ro()[smaPos]);
const auto &smaMax = reinterpret_cast<const double &>(b.get_ro()[smaPos + sizeof(double)]);
PLOG("predicate range: " << std::get<double>(p.second.first) << '-'
......@@ -1058,7 +1059,7 @@ class PTable {
}
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
const auto &smaMinPos = (uint16_t &) b.get_ro()[smaPos];
const auto &smaMaxPos = (uint16_t &) b.get_ro()[smaPos + gOffsetSize];
const auto smaMin(reinterpret_cast<const char (&)[]>(b.get_ro()[smaMinPos]));
......@@ -1092,21 +1093,21 @@ class PTable {
auto offset = ptp.getOffsetAt(p.first);
switch (tInfo.columnInfo(p.first).getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
const auto &value = reinterpret_cast<const int &>(b[offset]);
if (std::get<int>(p.second.second) < value || std::get<int>(p.second.first) > value) {
return false;
}
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
const auto &value = reinterpret_cast<const double &>(b[offset]);
if (std::get<double>(p.second.second) < value || std::get<double>(p.second.first) > value) {
return false;
}
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
const std::string value(reinterpret_cast<const char (&)[]>(b[offset]));
if (std::get<std::string>(p.second.second) < value || std::get<std::string>(p.second.first) > value) {
return false;
......@@ -1164,7 +1165,7 @@ class PTable {
const auto &dataPos = reinterpret_cast<const uint16_t &>(b[gDataOffsetPos + idx * gAttrOffsetSize]);
switch (c.getType()) {
case ColumnInfo::Int_Type: {
case Int_Type: {
const auto nextMiniPageStart =
(std::tuple_size<Tuple>::value == idx + 1) ? gBlockSize : reinterpret_cast<const uint16_t &>(b[gSmaOffsetPos
+ (idx + 1) * gAttrOffsetSize]);
......@@ -1174,7 +1175,7 @@ class PTable {
}
break;
case ColumnInfo::Double_Type: {
case Double_Type: {
const auto nextMiniPageStart =
(std::tuple_size<Tuple>::value == idx + 1) ? gBlockSize : reinterpret_cast<const uint16_t &>(b[gSmaOffsetPos
+ (idx + 1) * gAttrOffsetSize]);
......@@ -1184,7 +1185,7 @@ class PTable {
}
break;
case ColumnInfo::String_Type: {
case String_Type: {
uint16_t freeSpaceMiniPage;
auto iterBegin = buf.cbegin() + recordOffset;
const auto value = deserialize<std::string>(iterBegin, buf.end());
......
include(../../cmake/Testing.cmake.in)
if (BUILD_BENCHMARKS)
do_test(insert)
do_test(scan)
do_test(point)
endif()
......@@ -17,21 +17,65 @@
* along with PTable. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PTABLE_COMMON_H
#define PTABLE_COMMON_H
#include <chrono>
#include <unistd.h>
#include "PTable.hpp"
using namespace ptable;
using nvml::obj::make_persistent;
using nvml::obj::p;
using nvml::obj::persistent_ptr;
using nvml::obj::pool;
using nvml::obj::transaction;
using MyTuple = std::tuple<int, int, std::string, double>;
using PTableType = PTable<MyTuple, int>;
const auto tuples = 1000 * 1000;
using PTableType = ptable::PTable<MyTuple, int>;
using Vector = std::vector<int>;
using VectorVector = std::vector<Vector>;
const int hibit(int n) noexcept;
template <size_t SIZE>
static inline VectorVector *createPointVector(VectorVector *v);
struct root {
persistent_ptr<PTableType> pTable;
};
int hibit(int n) {
const std::string path = "/mnt/pmem/test/benchdb.db";
const auto NUM_TUPLES = 100 * 1000;
const auto POOL_SIZE = 1024 * 1024 * 256;
const auto ALIGNMENT = hibit(NUM_TUPLES) + 1;
VectorVector pv;
const auto POINT_ACCESS = *createPointVector<NUM_TUPLES>(&pv);
const VectorVector KEY_RANGES = {
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 2000, NUM_TUPLES / 2 + NUM_TUPLES / 2000}, // 0,1%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 400, NUM_TUPLES / 2 + NUM_TUPLES / 400}, // 0,5%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 200, NUM_TUPLES / 2 + NUM_TUPLES / 200}, // 1,0%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 40, NUM_TUPLES / 2 + NUM_TUPLES / 40}, // 5,0%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 20, NUM_TUPLES / 2 + NUM_TUPLES / 20}, // 10,0%
Vector{0, NUM_TUPLES-1} //100,0%
};
const VectorVector NON_KEY_RANGES = {
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 1000, NUM_TUPLES / 2 + NUM_TUPLES / 1000,
NUM_TUPLES / 2, NUM_TUPLES / 2 + NUM_TUPLES / 500}, // 0,1%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 200, NUM_TUPLES / 2 + NUM_TUPLES / 200,
NUM_TUPLES / 2, NUM_TUPLES / 2 + NUM_TUPLES / 100}, // 0,5%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 100, NUM_TUPLES / 2 + NUM_TUPLES / 100,
NUM_TUPLES / 2, NUM_TUPLES / 2 + NUM_TUPLES / 50}, // 1,0%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 20, NUM_TUPLES / 2 + NUM_TUPLES / 20,
NUM_TUPLES / 2, NUM_TUPLES / 2 + NUM_TUPLES / 10}, // 5,0%
Vector{NUM_TUPLES / 2 - NUM_TUPLES / 10, NUM_TUPLES / 2 + NUM_TUPLES / 10,
NUM_TUPLES / 2, NUM_TUPLES / 2 + NUM_TUPLES / 5}, // 10,0%
Vector{0, NUM_TUPLES - 1, 0, NUM_TUPLES - 1} //100,0%
};
const int hibit(int n) noexcept {
n |= (n >> 1);
n |= (n >> 2);
n |= (n >> 4);
......@@ -40,41 +84,38 @@ int hibit(int n) {
return n - (n >> 1);
}
int main() {
template<size_t SIZE>
static inline VectorVector *createPointVector(VectorVector *v) {
if (SIZE >= 100) {
createPointVector<SIZE / 10>(v);
v->emplace_back(Vector{SIZE, SIZE / 2});
}
return v;
}
void insert (pool<root> &pop, const std::string &path, size_t entries) {
using namespace ptable;
std::chrono::high_resolution_clock::time_point start, end;
std::vector<typename std::chrono::duration<int64_t, std::micro>::rep> measures;
struct root {
persistent_ptr<PTableType> pTable;
};
pool<root> pop;
const std::string path = "/mnt/pmem/test/benchdb.db";
std::remove(path.c_str());
if (access(path.c_str(), F_OK) != 0) {
pop = pool<root>::create(path, LAYOUT, 1 << 30);
pop = pool<root>::create(path, LAYOUT, POOL_SIZE);
transaction::exec_tx(pop, [&] {
auto tInfo = TableInfo("MyTable", {
ColumnInfo("a", ColumnInfo::Int_Type),
ColumnInfo("b", ColumnInfo::Int_Type),
ColumnInfo("c", ColumnInfo::String_Type),
ColumnInfo("d", ColumnInfo::Double_Type)
const auto tInfo = ptable::VTableInfo("MyTable", {
{"a", Int_Type},
{"b", Int_Type},
{"c", String_Type},
{"d", Double_Type}
}, Int_Type);
const auto dims = Dimensions({
{0, {10, ALIGNMENT}},
{3, {10, ALIGNMENT}}
});
auto alignment = hibit(tuples) + 1;
pop.get_root()->pTable =
make_persistent<PTableType>(tInfo, Dimensions({{0, {10, alignment}}, {3, {10, alignment}}}));
pop.get_root()->pTable = make_persistent<PTableType>(tInfo, dims);
});
} else {
std::cerr << "WARNING: Table already exists" << std::endl;
pop = pool<root>::open(path, LAYOUT);
}
auto pTable = pop.get_root()->pTable;
auto &pTable = pop.get_root()->pTable;
for (unsigned int i = 0; i < tuples; i++) {
for (auto i = 0u; i < entries; i++) {
auto tup = MyTuple(i + 1,
(i + 1) * 100,
fmt::format("String #{0}", i),
......@@ -88,10 +129,11 @@ int main() {
auto avg = std::accumulate(measures.begin(), measures.end(), 0) / measures.size();
auto minmax = std::minmax_element(std::begin(measures), std::end(measures));
std::cout << "\nInsert Statistics in µs: "
PLOG("\nInsert Statistics in µs: "
<< "\n\tAvg: \t" << avg
<< "\n\tMin: \t" << *minmax.first
<< "\n\tMax: \t" << *minmax.second << '\n';
<< "\n\tMax: \t" << *minmax.second);
pop.close();
}
#endif /* PTABLE_COMMON_H */
\ No newline at end of file
......@@ -18,26 +18,13 @@
*/
#include <unistd.h>
#include "benchmark/benchmark.h"
#include "fmt/format.h"
#include "PTable.hpp"
#include "common.h"
using namespace ptable;
using nvml::obj::make_persistent;
using nvml::obj::p;
using nvml::obj::persistent_ptr;
using nvml::obj::pool;
using nvml::obj::transaction;
using MyTuple = std::tuple<int, int, std::string, double>;
using PTableType = PTable<MyTuple, int>;
static void BM_PointQuery(benchmark::State& state) {
struct root {
persistent_ptr<PTableType> pTable;
};
pool<root> pop;
......@@ -46,17 +33,7 @@ static void BM_PointQuery(benchmark::State& state) {
std::remove(path.c_str());
if (access(path.c_str(), F_OK) != 0) {
pop = pool<root>::create(path, LAYOUT, 1 << 30);
transaction::exec_tx(pop, [&] {
auto tInfo = TableInfo("MyTable", {
ColumnInfo("a", ColumnInfo::Int_Type),
ColumnInfo("b", ColumnInfo::Int_Type),
ColumnInfo("c", ColumnInfo::String_Type),
ColumnInfo("d", ColumnInfo::Double_Type)
});
pop.get_root()->pTable =
make_persistent<PTableType>(tInfo, Dimensions({{0, {10, 17}}, {3, {10, 17}}}));
});
insert(pop, path, state.range(1));
} else {
std::cerr << "WARNING: Table already exists" << std::endl;
pop = pool<root>::open(path, LAYOUT);
......@@ -64,14 +41,6 @@ static void BM_PointQuery(benchmark::State& state) {
auto pTable = pop.get_root()->pTable;
for (auto i = 0; i < state.range(0); i++) {
auto tup = MyTuple(i + 1,
(i + 1) * 100,
fmt::format("String #{0}", i),
(i + 1) * 1.0);
pTable->insert(i + 1, tup);
}
for (auto _ : state) {
auto ptp = pTable->getByKey(state.range(1));
if (ptp.getNode() != nullptr) ptp.createTuple();
......@@ -80,11 +49,9 @@ static void BM_PointQuery(benchmark::State& state) {
pop.close();
std::remove(path.c_str());
}
BENCHMARK(BM_PointQuery)
->Args({100,50})
->Args({1000,500})
->Args({10000,5000})
->Args({100000,50000});
// ->Args({1000000,500000});
static void VectorArguments(benchmark::internal::Benchmark* b) {
for (const auto &arg : POINT_ACCESS) b->Args(arg);
}
BENCHMARK(BM_PointQuery)->Apply(VectorArguments);
BENCHMARK_MAIN();
......@@ -18,31 +18,20 @@
*/
#include <unistd.h>
#include "benchmark/benchmark.h"
#include "PTable.hpp"
#include "common.h"
using namespace ptable;
using nvml::obj::make_persistent;
using nvml::obj::p;
using nvml::obj::persistent_ptr;
using nvml::obj::pool;
using nvml::obj::transaction;
using MyTuple = std::tuple<int, int, std::string, double>;
using PTableType = PTable<MyTuple, int>;
const std::string path = "/mnt/pmem/test/benchdb.db";
static void BM_RangeScan(benchmark::State& state) {
struct root {
persistent_ptr<PTableType> pTable;
};
static void BM_RangeScan(benchmark::State &state) {
pool<root> pop;
if (access(path.c_str(), F_OK) != 0) {
throw PTableException("ERROR: Table not found");
insert(pop, path, NUM_TUPLES);
} else {
PLOG("Warning: " << path << " already exists");
pop = pool<root>::open(path, LAYOUT);
}
......@@ -50,31 +39,26 @@ static void BM_RangeScan(benchmark::State& state) {
/* RangeScan using Block iterator */
for (auto _ : state) {
auto iter = pTable->rangeScan(ColumnRangeMap({{0, std::make_pair<int, int>(state.range(0), state.range(1))}/*,
{2, std::make_pair<std::string, std::string>("String #1", "String #9")}*/}));
auto iter = pTable->rangeScan(ColumnRangeMap({{0, {state.range(0), state.range(1)}}}));
for (const auto &tp: iter) {
tp;
}
}
pop.close();
}
BENCHMARK(BM_RangeScan)
->Args({499500,500500}) // 0,1%
->Args({497500,502500}) // 0,5%
->Args({495000,505000}) // 1,0%
->Args({475000,525000}) // 5,0%
->Args({450000,550000});// 10,0%
static void BM_NonKeyRangeScan(benchmark::State& state) {
struct root {
persistent_ptr<PTableType> pTable;
};
static void KeyRangeArguments(benchmark::internal::Benchmark* b) {
for (const auto &arg : KEY_RANGES) b->Args(arg);
}
BENCHMARK(BM_RangeScan)->Apply(KeyRangeArguments);
static void BM_NonKeyRangeScan(benchmark::State &state) {
pool<root> pop;
if (access(path.c_str(), F_OK) != 0) {
std::cerr << "ERROR: Table not found" << std::endl;
return;
insert(pop, path, NUM_TUPLES);
} else {
PLOG("Warning: " << path << " already exists");
pop = pool<root>::open(path, LAYOUT);
}
......@@ -82,31 +66,27 @@ static void BM_NonKeyRangeScan(benchmark::State& state) {
/* RangeScan using Block iterator */
for (auto _ : state) {
auto iter = pTable->rangeScan(ColumnRangeMap({{0, std::make_pair<int, int>(state.range(0), state.range(1))},
{3, std::make_pair<double, double>(state.range(2), state.range(3))}}));
auto iter = pTable->rangeScan(ColumnRangeMap({{0, {state.range(0), state.range(1)}},
{3, {(double)state.range(2), (double)state.range(3)}}}));
for (const auto &tp: iter) {
tp;
}
}
pop.close();
}