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
10 changes: 7 additions & 3 deletions cpp/perspective/src/cpp/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ namespace perspective {
void
psp_abort(const std::string& message) {
#ifdef PSP_ENABLE_WASM
std::cerr << "Abort(): " << message << std::endl;
std::string error = "Abort(): " + message;
const char* error_cstr = error.c_str();

EM_ASM({
throw new Error('abort()');
});
// copy string out from heap
// https://emscripten.org/docs/api_reference/emscripten.h.html#c.EM_ASM
throw new Error(UTF8ToString($0));
}, error_cstr);
#else
throw PerspectiveException(message.c_str());
#endif
Expand Down
2 changes: 0 additions & 2 deletions cpp/perspective/src/include/perspective/multi_sort.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ cmp_mselem(const t_mselem& a, const t_mselem& b, const std::vector<t_sorttype>&

t_sorttype order = sort_order[idx];

#ifndef PSP_ENABLE_WASM
t_nancmp nancmp = nan_compare(order, first, second);

if (first.is_floating_point() && nancmp.m_active) {
Expand All @@ -113,7 +112,6 @@ cmp_mselem(const t_mselem& a, const t_mselem& b, const std::vector<t_sorttype>&
default: { continue; } break;
}
}
#endif

if (first == second)
continue;
Expand Down
9 changes: 9 additions & 0 deletions cpp/perspective/src/include/perspective/traversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ class t_traversal {
std::shared_ptr<std::vector<t_tvnode>> m_nodes;
};

/**
* @brief Sort implementation for `t_ctx1` and `t_ctx2` contexts.
*
* @tparam SRC_T
* @param config
* @param sortby
* @param src
* @param ctx2
*/
template <typename SRC_T>
void
t_traversal::sort_by(const t_config& config, const std::vector<t_sortspec>& sortby,
Expand Down
5 changes: 0 additions & 5 deletions docs/md/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,6 @@ your changes to preserve them for future comparison.
yarn bench
```

Use the `--limit <NUMBER>` flag to control the number of Perspective versions
that the benchmark suite will run, where `<NUMBER>` is an integer greater
than 0. If `<NUMBER>` cannot be parsed, is 0, or is greater than the number of
versions, the benchmark suite will run all previous versions of Perspective.

The benchmarks report and `results.json` show a histogram of current
performance, as well as that of the previous `results.json`. Running this should
probably be standard practice after making a large change which may affect
Expand Down
98 changes: 91 additions & 7 deletions packages/perspective-bench/bench/perspective.benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,47 @@ describe("Update", async () => {
table = worker.table(data.arrow.slice());
view = table.view();

let test_data = await static_view[`to_${name}`]({end_row: 500});
const test_data = await static_view[`to_${name}`]({end_row: 500});

benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});

describe("ctx0 sorted", async () => {
table = worker.table(data.arrow.slice());
view = table.view({
sort: [["Customer Name", "desc"]]
});

const test_data = await static_view[`to_${name}`]({end_row: 500});

benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await view.num_rows();
}
});
});

describe("ctx0 sorted deep", async () => {
table = worker.table(data.arrow.slice());
//table_indexed = worker.table(data.arrow.slice(), {index: "Row ID"});
view = table.view({
sort: [
["Customer Name", "desc"],
["Order Date", "asc"]
]
});

const test_data = await static_view[`to_${name}`]({end_row: 500});
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await view.num_rows();
}
});
});
Expand All @@ -168,7 +204,7 @@ describe("Update", async () => {
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});
Expand All @@ -182,7 +218,7 @@ describe("Update", async () => {
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});
Expand All @@ -197,7 +233,7 @@ describe("Update", async () => {
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});
Expand All @@ -212,7 +248,7 @@ describe("Update", async () => {
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});
Expand All @@ -226,7 +262,7 @@ describe("Update", async () => {
benchmark(name, async () => {
for (let i = 0; i < 5; i++) {
table.update(test_data.slice ? test_data.slice() : test_data);
await table.size();
await view.num_rows();
}
});
});
Expand Down Expand Up @@ -371,6 +407,54 @@ describe("View", async () => {
});
});

describe(`${cat} sorted`, async () => {
let view;

afterEach(async () => {
await view.delete();
});

benchmark(`sorted float asc`, async () => {
view = table.view({
aggregate,
row_pivot,
column_pivot,
sort: [["Sales", "asc"]]
});
await view.schema();
});

benchmark(`sorted float desc`, async () => {
view = table.view({
aggregate,
row_pivot,
column_pivot,
sort: [["Sales", "asc"]]
});
await view.schema();
});

benchmark(`sorted str asc`, async () => {
view = table.view({
aggregate,
row_pivot,
column_pivot,
sort: [["Customer Name", "asc"]]
});
await view.schema();
});

benchmark(`sorted str desc`, async () => {
view = table.view({
aggregate,
row_pivot,
column_pivot,
sort: [["Customer Name", "desc"]]
});
await view.schema();
});
});

describe(cat, async () => {
let view;

Expand Down
23 changes: 22 additions & 1 deletion packages/perspective-bench/bench/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,28 @@ const JPMC_VERSIONS = [

const FINOS_VERSIONS = ["0.3.1", "0.3.0", "0.3.0-rc.3", "0.3.0-rc.2", "0.3.0-rc.1"];

const UMD_VERSIONS = ["0.5.6", "0.5.5", "0.5.4", "0.5.3", "0.5.2", "0.5.1", "0.5.0", "0.4.8", "0.4.7", "0.4.6", "0.4.5", "0.4.4", "0.4.2", "0.4.1", "0.4.0", "0.3.9", "0.3.8", "0.3.7", "0.3.6"];
const UMD_VERSIONS = [
"0.6.0",
"0.5.6",
"0.5.5",
"0.5.4",
"0.5.3",
"0.5.2",
"0.5.1",
"0.5.0",
"0.4.8",
"0.4.7",
"0.4.6",
"0.4.5",
"0.4.4",
"0.4.2",
"0.4.1",
"0.4.0",
"0.3.9",
"0.3.8",
"0.3.7",
"0.3.6"
];

async function run() {
await PerspectiveBench.run("master", "bench/perspective.benchmark.js", `http://${process.env.PSP_DOCKER_PUPPETEER ? `localhost` : `host.docker.internal`}:8080/perspective.js`, {
Expand Down
Loading