Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/pisa/util/json_stats.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace pisa {
namespace detail {
class StatsInterface {
public:
virtual ~StatsInterface() = default;
virtual void add(std::string const& key, bool value) = 0;
virtual void add(std::string const& key, std::int64_t value) = 0;
virtual void add(std::string const& key, std::uint64_t value) = 0;
Expand Down
18 changes: 8 additions & 10 deletions tools/queries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
#include "topk_queue.hpp"
#include "type_alias.hpp"
#include "util/do_not_optimize_away.hpp"
#include "util/util.hpp"
#include "wand_data.hpp"
#include "wand_data_compressed.hpp"
#include "wand_data_raw.hpp"
Expand All @@ -63,7 +62,7 @@ class AggregationType {
enum Value { None = 0, Min = 1, Mean = 2, Median = 3, Max = 4 };

explicit constexpr AggregationType(Value value) : m_value(value) {}
constexpr operator Value() const { return m_value; }
constexpr explicit operator Value() const { return m_value; }

[[nodiscard]] auto to_string() const -> std::string {
switch (m_value) {
Expand Down Expand Up @@ -157,12 +156,12 @@ struct QueryTimes {
}

auto aggregate(AggregationType aggregation_type) const -> std::vector<std::size_t> {
switch (aggregation_type) {
case AggregationType::None: return aggregate_none();
case AggregationType::Min: return aggregate_min();
case AggregationType::Mean: return aggregate_mean();
case AggregationType::Median: return aggregate_median();
case AggregationType::Max: return aggregate_max();
switch (AggregationType::Value(aggregation_type)) {
case AggregationType::Value::None: return aggregate_none();
case AggregationType::Value::Min: return aggregate_min();
case AggregationType::Value::Mean: return aggregate_mean();
case AggregationType::Value::Median: return aggregate_median();
case AggregationType::Value::Max: return aggregate_max();
}
throw std::logic_error("Unknown AggregationType");
}
Expand Down Expand Up @@ -328,8 +327,7 @@ void perftest(

auto scorer = scorer::from_params(scorer_params, wdata);

for (std::size_t query_type_idx = 0; query_type_idx < query_types.size(); ++query_type_idx) {
auto const& t = query_types[query_type_idx];
for (const auto& t: query_types) {
spdlog::info("Performing {} runs for '{}' queries...", runs, t);

std::function<uint64_t(Query, Score)> query_fun;
Expand Down