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
59 changes: 59 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 10 additions & 8 deletions rust/perspective-server/cpp/perspective/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,16 @@ if(PSP_WASM_BUILD)
")
endif()
else()
set(OPT_FLAGS " -O3 -g${DEBUG_LEVEL} ")
set(OPT_FLAGS " \
-O3 -g${DEBUG_LEVEL} \
-mbulk-memory \
-msimd128 \
-mrelaxed-simd \
-flto \
--emit-tsd=perspective-server.d.ts \
")
if (PSP_WASM_EXCEPTIONS)
set(OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions -flto --emit-tsd=perspective-server.d.ts ")
set(OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions ")
endif()
endif()
elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
Expand Down Expand Up @@ -295,6 +302,7 @@ elseif(PSP_CPP_BUILD OR PSP_PYTHON_BUILD)
-O3 \
-fexceptions \
-g1 \
-fopenmp-simd \
")
if (PSP_WASM_EXCEPTIONS)
set(OPT_FLAGS "${OPT_FLAGS} -fwasm-exceptions ")
Expand Down Expand Up @@ -335,15 +343,9 @@ endif()

if (PSP_WASM64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \
-mbulk-memory \
-msimd128 \
-mrelaxed-simd \
-s MEMORY64=1 \
")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \
-mbulk-memory \
-msimd128 \
-mrelaxed-simd \
-s MEMORY64=1 \
")
endif()
Expand Down
4 changes: 2 additions & 2 deletions rust/perspective-server/cpp/perspective/src/cpp/aggregate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ t_aggregate::t_aggregate(
) :
m_tree(tree),
m_aggtype(aggtype),
m_icolumns(std::move(std::move(icolumns))),
m_ocolumn(std::move(std::move(ocolumn))) {}
m_icolumns(std::move(icolumns)),
m_ocolumn(std::move(ocolumn)) {}

void
t_aggregate::init() {
Expand Down
82 changes: 57 additions & 25 deletions rust/perspective-server/cpp/perspective/src/cpp/arg_sort.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,76 @@ t_argsort_comparator::t_argsort_comparator(

bool
t_argsort_comparator::operator()(t_index a, t_index b) const {
const t_tscalar& first = m_v[a];
const t_tscalar& second = m_v[b];

switch (m_sort_type) {
case SORTTYPE_ASCENDING: {
return (first < second);
} break;
case SORTTYPE_DESCENDING: {
return (first > second);
} break;
case SORTTYPE_ASCENDING_ABS: {
return std::abs(first.to_double()) < std::abs(second.to_double());
} break;
case SORTTYPE_DESCENDING_ABS: {

return std::abs(first.to_double()) > std::abs(second.to_double());
} break;
case SORTTYPE_NONE: {
return a < b;
}
case SORTTYPE_ASCENDING:
return t_argsort_comparator_impl<SORTTYPE_ASCENDING>(m_v)(a, b);
case SORTTYPE_DESCENDING:
return t_argsort_comparator_impl<SORTTYPE_DESCENDING>(m_v)(a, b);
case SORTTYPE_ASCENDING_ABS:
return t_argsort_comparator_impl<SORTTYPE_ASCENDING_ABS>(m_v)(a, b);
case SORTTYPE_DESCENDING_ABS:
return t_argsort_comparator_impl<SORTTYPE_DESCENDING_ABS>(m_v)(
a, b
);
case SORTTYPE_NONE:
return t_argsort_comparator_impl<SORTTYPE_NONE>(m_v)(a, b);
}

return a < b;
}

namespace {

void
init_output(std::vector<t_index>& output) {
for (t_index i = 0, loop_end = output.size(); i != loop_end; ++i) {
output[i] = i;
}
}

} // anonymous namespace

void
simple_argsort(
std::vector<t_tscalar>& v,
std::vector<t_index>& output,
const t_sorttype& sort_type
) {
// Output should be the same size is v
for (t_index i = 0, loop_end = output.size(); i != loop_end; ++i) {
output[i] = i;
}
t_argsort_comparator cmp(v, sort_type);
init_output(output);

std::sort(output.begin(), output.end(), cmp);
switch (sort_type) {
case SORTTYPE_ASCENDING: {
std::sort(
output.begin(),
output.end(),
t_argsort_comparator_impl<SORTTYPE_ASCENDING>(v)
);
} break;
case SORTTYPE_DESCENDING: {
std::sort(
output.begin(),
output.end(),
t_argsort_comparator_impl<SORTTYPE_DESCENDING>(v)
);
} break;
case SORTTYPE_ASCENDING_ABS: {
std::sort(
output.begin(),
output.end(),
t_argsort_comparator_impl<SORTTYPE_ASCENDING_ABS>(v)
);
} break;
case SORTTYPE_DESCENDING_ABS: {
std::sort(
output.begin(),
output.end(),
t_argsort_comparator_impl<SORTTYPE_DESCENDING_ABS>(v)
);
} break;
case SORTTYPE_NONE: {
// output is already identity-initialized
} break;
}
}

} // namespace perspective
2 changes: 1 addition & 1 deletion rust/perspective-server/cpp/perspective/src/cpp/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ root_pidx() {

bool
is_internal_colname(const std::string& c) {
return c == std::string("psp_");
return c == "psp_";
}

template <typename T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ t_ctx_grouped_pkey::get_data(
for (t_uindex aggidx = 0, loop_end = aggcols.size(); aggidx < loop_end;
++aggidx) {
const std::string& aggname = aggschema.m_columns[aggidx];
aggcols[aggidx] = aggtable->get_const_column(aggname).get();
aggcols[aggidx] = aggtable->_get_const_column(aggname);
}

const std::vector<t_aggspec>& aggspecs = m_config.get_aggregates();
Expand Down Expand Up @@ -520,12 +520,12 @@ t_ctx_grouped_pkey::rebuild() {
};

const auto* sortby_col =
tbl->get_const_column(m_config.get_sort_by(child_col_name)).get();
tbl->_get_const_column(m_config.get_sort_by(child_col_name));

const auto* parent_col =
tbl->get_const_column(m_config.get_parent_pkey_column()).get();
tbl->_get_const_column(m_config.get_parent_pkey_column());

const auto* pkey_col = tbl->get_const_column("psp_pkey").get();
const auto* pkey_col = tbl->_get_const_column("psp_pkey");

std::vector<t_datum> data(nrows);
tsl::hopscotch_map<t_tscalar, t_uindex> child_ridx_map;
Expand Down Expand Up @@ -651,9 +651,9 @@ t_ctx_grouped_pkey::rebuild() {
const t_aggspec& spec = aggspecs[aggnum];
if (spec.agg() == AGGTYPE_IDENTITY) {
auto* scol =
aggtable->get_column(spec.get_first_depname()).get();
aggtable->_get_column(spec.get_first_depname());
scol->copy(
tbl->get_const_column(spec.get_first_depname()).get(),
tbl->_get_const_column(spec.get_first_depname()),
aggindices,
1
);
Expand Down
Loading
Loading