Skip to content

Commit

Permalink
fix benchmark using local docker, remove unused functions, fix delete…
Browse files Browse the repository at this point in the history
… test
  • Loading branch information
sc1f committed May 16, 2019
1 parent 1fbeedb commit 38babcd
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 36 deletions.
6 changes: 3 additions & 3 deletions cpp/perspective/src/cpp/context_two.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,15 +675,15 @@ t_ctx2::get_step_delta(t_index bidx, t_index eidx) {
*/
t_rowdelta
t_ctx2::get_row_delta() {
t_uindex nrows = get_row_count();
t_uindex ncols = get_num_view_columns();
t_index nrows = get_row_count();
t_index ncols = get_num_view_columns();
tsl::hopscotch_set<t_index> rows;

std::vector<std::pair<t_uindex, t_uindex>> cells;

// get cells and imbue with additional information
for (t_index ridx = 0; ridx < nrows; ++ridx) {
for (t_uindex cidx = 1; cidx < ncols; ++cidx) {
for (t_index cidx = 1; cidx < ncols; ++cidx) {
cells.push_back(std::pair<t_index, t_index>(ridx, cidx));
}
}
Expand Down
18 changes: 0 additions & 18 deletions cpp/perspective/src/cpp/flat_traversal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,24 +184,6 @@ t_ftrav::get_row_indices(const tsl::hopscotch_set<t_tscalar>& pkeys) const {
return rows;
}

/**
* @brief Given a primary key, return the row index at which the primary key is mapped.
*
* @param pkey
* @return t_index
*/
t_index
t_ftrav::get_row_index(t_tscalar pkey) const {
for (t_index idx = 0, loop_end = size(); idx < loop_end; ++idx) {
const t_tscalar& found_pkey = (*m_index)[idx].m_pkey;
if (found_pkey == pkey) {
return idx;
}
}
PSP_COMPLAIN_AND_ABORT("Invalid primary key in row lookup!");
return t_index();
}

void
t_ftrav::reset() {
if (m_index.get())
Expand Down
2 changes: 0 additions & 2 deletions cpp/perspective/src/include/perspective/flat_traversal.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ class PERSPECTIVE_EXPORT t_ftrav {
tsl::hopscotch_set<t_index> get_row_indices(
const tsl::hopscotch_set<t_tscalar>& pkeys) const;

t_index get_row_index(t_tscalar pkey) const;

void reset();

void check_size();
Expand Down
8 changes: 3 additions & 5 deletions packages/perspective/bench/js/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,15 @@ const JPMC_VERSIONS = [
"0.2.0"
];

const FINOS_VERSIONS = [
"0.3.0-rc.1"
]
const FINOS_VERSIONS = ["0.3.0-rc.1"];

const JPMC_URLS = multi_template`https://unpkg.com/@jpmorganchase/perspective@${JPMC_VERSIONS}/build/perspective.js`;
const FINOS_URLS = multi_template`https://unpkg.com/@finos/perspective@${FINOS_VERSIONS}/build/perspective.js`
const FINOS_URLS = multi_template`https://unpkg.com/@finos/perspective@${FINOS_VERSIONS}/build/perspective.js`;

const OLD_FORMAT_JPMC_VERSIONS = ["0.2.0-beta.3"];
const OLD_FORMAT_JPMC_URLS = multi_template`https://unpkg.com/@jpmorganchase/perspective-examples@${OLD_FORMAT_JPMC_VERSIONS}/build/perspective.js`;

const URLS = [].concat([["master", `http://localhost:8080/perspective.js`]], FINOS_URLS, JPMC_URLS, OLD_FORMAT_JPMC_URLS);
const URLS = [].concat([["master", `http://host.docker.internal:8080/perspective.js`]], FINOS_URLS, JPMC_URLS, OLD_FORMAT_JPMC_URLS);

const RUN_TEST = fs.readFileSync(path.join(__dirname, "browser_runtime.js")).toString();

Expand Down
11 changes: 6 additions & 5 deletions packages/perspective/bench/js/browser_runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@ function to_name({aggregate, row_pivot, column_pivot}) {
}

async function* filterOutliers(someArray) {
const values = [], orig = [];
const values = [],
orig = [];
for await (const row of someArray) {
values.push(row.time);
orig.push(row);
}
values.sort((a, b) => a - b);

const q1 = values[Math.floor((values.length / 4))];
const q3 = values[Math.ceil((values.length * (3 / 4)))];
const q1 = values[Math.floor(values.length / 4)];
const q3 = values[Math.ceil(values.length * (3 / 4))];
const iqr = q3 - q1;
const maxValue = q3 + iqr;
const minValue = q1 - iqr;

for (const idx in orig) {
row = orig[idx];
row.outlier = (row.time > maxValue) || (row.time < minValue)
let row = orig[idx];
row.outlier = row.time > maxValue || row.time < minValue;
yield row;
}
}
Expand Down
8 changes: 5 additions & 3 deletions packages/perspective/test/js/delta.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,18 @@ module.exports = perspective => {
table.update(partial_change_y);
});

it.skip("returns deleted columns", async function(done) {
it("returns deleted columns", async function(done) {
let table = perspective.table(data, {index: "x"});
let view = table.view({
row_pivots: ["y"],
column_pivots: ["x"]
column_pivots: ["x"],
aggregates: {y: "unique"},
columns: ["x", "y", "z"]
});
view.on_update(
async function(delta) {
// underlying data changes, but only total aggregate row is affected
expect(delta).toEqual([0]);
expect(delta).toEqual([0, 1, 2, 4]);
view.delete();
table.delete();
done();
Expand Down

0 comments on commit 38babcd

Please sign in to comment.