Skip to content

Commit

Permalink
Merge branch 'master' into perspective-cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeSheard authored Jan 23, 2019
2 parents e014f76 + d580705 commit f078f4d
Show file tree
Hide file tree
Showing 45 changed files with 5,410 additions and 2,257 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,5 @@ website/static/css/material.dark.css
/src/include/boost
cjs
obj
packages/perspective/es5
cppbuild
.coverage
9 changes: 5 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ set (SOURCE_FILES
src/cpp/base_impl_osx.cpp
src/cpp/base_impl_wasm.cpp
src/cpp/base_impl_win.cpp
src/cpp/binding.cpp
src/cpp/build_filter.cpp
#src/cpp/calc_agg_dtype.cpp
src/cpp/column.cpp
Expand Down Expand Up @@ -292,21 +293,21 @@ if (PSP_WASM_BUILD)
add_library(psp ${SOURCE_FILES})
set_target_properties(psp PROPERTIES COMPILE_FLAGS "${ASYNC_MODE_FLAGS}")

add_executable(perspective.async src/cpp/main.cpp)
add_executable(perspective.async src/cpp/emscripten.cpp)
target_link_libraries(perspective.async psp "${ASYNC_MODE_FLAGS}")
set_target_properties(perspective.async PROPERTIES COMPILE_FLAGS "${ASYNC_MODE_FLAGS}")
set_target_properties(perspective.async PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
set_target_properties(perspective.async PROPERTIES OUTPUT_NAME "psp.async")

add_executable(perspective.sync src/cpp/main.cpp)
add_executable(perspective.sync src/cpp/emscripten.cpp)
target_link_libraries(perspective.sync psp "${SYNC_MODE_FLAGS}")
set_target_properties(perspective.sync PROPERTIES COMPILE_FLAGS "${SYNC_MODE_FLAGS}")
set_target_properties(perspective.sync PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
set_target_properties(perspective.sync PROPERTIES OUTPUT_NAME "psp.sync")
add_dependencies(perspective.sync perspective.async)

if (NOT CMAKE_BUILD_TYPE_LOWER STREQUAL debug)
add_executable(perspective.asm src/cpp/main.cpp)
add_executable(perspective.asm src/cpp/emscripten.cpp)
target_link_libraries(perspective.asm psp "${ASMJS_MODE_FLAGS}")
set_target_properties(perspective.asm PROPERTIES COMPILE_FLAGS "${ASMJS_MODE_FLAGS}")
set_target_properties(perspective.asm PROPERTIES RUNTIME_OUTPUT_DIRECTORY "./build/")
Expand All @@ -324,7 +325,7 @@ else()
target_link_libraries(psp ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
set(CMAKE_SHARED_LIBRARY_SUFFIX .so)

add_library(binding SHARED ${CMAKE_SOURCE_DIR}/python/perspective/src/binding.cpp)
add_library(binding SHARED ${CMAKE_SOURCE_DIR}/python/perspective/src/python.cpp)
target_link_libraries(binding psp)
target_link_libraries(binding tbb)
target_link_libraries(binding ${BOOST_PYTHON})
Expand Down
7 changes: 6 additions & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,14 @@ with 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 historgram 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 performance, but please create a baseline `results.json` entry for your
test machine on a commit before your changes first, such that the affect of your
test machine on a commit before your changes first, such that the effects of your
PR can be properly compared.
10 changes: 7 additions & 3 deletions examples/webpack/in.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
*/

const perspective = require("@jpmorganchase/perspective").default;
require("@jpmorganchase/perspective-viewer");

const table = perspective.worker().table([{x: 1}]);
table.view().to_json(console.log);
(async () => {
const worker = perspective.worker();
const table = worker.table([{x: 1, y: 2}, {x: 2, y: 2}]);
const view = await table.view();
const json = await view.to_json();
console.log(json);
})();
11 changes: 9 additions & 2 deletions examples/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@
"version": "0.2.12",
"description": "An example of using the Perspective Webpack plugin to build a JS file with Webpack.",
"scripts": {
"start": "node server.js",
"start": "webpack-dev-server --content-base ./ --hot",
"webpack": "webpack --config webpack.config.js --color"
},
"keywords": [],
"license": "Apache-2.0",
"dependencies": {
"@jpmorganchase/perspective": "^0.2.12",
"@jpmorganchase/perspective-viewer": "^0.2.12"
"@jpmorganchase/perspective-viewer": "^0.2.12",
"@jpmorganchase/perspective-viewer-highcharts": "^0.2.12",
"@jpmorganchase/perspective-viewer-hypergrid": "^0.2.12"
},
"devDependencies": {
"webpack": "^4.28.4",
"webpack-cli": "3.2.1",
"webpack-dev-server": "^3.1.14"
}
}
2 changes: 2 additions & 0 deletions examples/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const PerspectivePlugin = require("@jpmorganchase/perspective/webpack-plugin");
const path = require("path");

module.exports = {
context: __dirname,
mode: "development",
entry: "./in.js",
output: {
filename: "out.js",
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
],
"devDependencies": {
"@apache-arrow/es5-esm": "^0.3.1",
"babel-core": "^7.0.0-0",
"babel-eslint": "^8.2.3",
"babel-jest": "^23.6.0",
"@babel/cli": "^7.2.3",
Expand Down
8 changes: 6 additions & 2 deletions packages/perspective-viewer-highcharts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
"name": "@jpmorganchase/perspective-viewer-highcharts",
"version": "0.2.12",
"description": "Perspective.js",
"main": "src/js/highcharts.js",
"main": "cjs/perspective-viewer-plugin-highcharts.js",
"files": [
"build/**/*",
"cjs/*",
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"build": "webpack --color --config src/config/highcharts.plugin.config.js",
"build:cjs": "webpack --color --config src/config/highcharts.plugin.cjs.config.js",
"build:umd": "webpack --color --config src/config/highcharts.plugin.config.js",
"build": "npm-run-all build:*",
"test:build": "cp test/html/* build",
"watch": "webpack --color --watch --config src/config/highcharts.plugin.config.js",
"test:run": "jest --silent --color 2>&1",
Expand Down Expand Up @@ -43,6 +46,7 @@
"@jpmorganchase/perspective-viewer": "^0.2.12",
"babel-runtime": "^6.26.0",
"chroma-js": "^1.3.4",
"detectie": "1.0.0",
"gradient-parser": "0.1.5",
"highcharts": "6.1.0",
"highcharts-grouped-categories": "1.1.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require("path");
const common = require("@jpmorganchase/perspective/src/config/common.config.js");
const {dependencies} = require("../../package.json");

const externals = Object.keys(dependencies).map(external => new RegExp(`^${external}.*$`));

module.exports = Object.assign({}, common({no_minify: true}), {
devtool: false,
entry: "./src/js/highcharts.js",
output: {
filename: "perspective-viewer-plugin-highcharts.js",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "../../cjs")
},
externals: [
function(context, request, callback) {
for (let external of externals) {
if (external.test(request)) {
return callback(null, "commonjs " + request);
}
}
callback();
}
]
});
2 changes: 1 addition & 1 deletion packages/perspective-viewer-highcharts/src/js/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {color_axis} from "./color_axis.js";
import {make_tree_data, make_y_data, make_xy_data, make_xyz_data, make_xy_column_data} from "./series.js";
import {set_boost, set_category_axis, set_both_axis, default_config, set_tick_size} from "./config.js";
import {bindTemplate} from "@jpmorganchase/perspective-viewer/src/js/utils";
import {detectIE} from "@jpmorganchase/perspective/src/js/utils";
import detectIE from "detectie";

export const PRIVATE = Symbol("Highcharts private");

Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-viewer-highcharts/src/js/series.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

import {COLUMN_SEPARATOR_STRING} from "@jpmorganchase/perspective/src/js/defaults.js";
const COLUMN_SEPARATOR_STRING = "|";

function row_to_series(series, sname, gname) {
let s;
Expand Down
7 changes: 5 additions & 2 deletions packages/perspective-viewer-hypergrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,20 @@
"name": "@jpmorganchase/perspective-viewer-hypergrid",
"version": "0.2.12",
"description": "Perspective.js",
"main": "src/js/hypergrid.js",
"main": "cjs/perspective-viewer-plugin-hypergrid.js",
"files": [
"build/**/*",
"cjs/*",
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"build": "webpack --color --config src/config/hypergrid.plugin.config.js",
"build:cjs": "webpack --color --config src/config/hypergrid.plugin.cjs.config.js",
"build:umd": "webpack --color --config src/config/hypergrid.plugin.config.js",
"build": "npm-run-all build:*",
"test:build": "cp test/html/* build",
"test:run": "jest --silent --color",
"test": "npm-run-all test:build test:run",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require("path");
const common = require("@jpmorganchase/perspective/src/config/common.config.js");
const {dependencies} = require("../../package.json");

const externals = Object.keys(dependencies).map(external => new RegExp(`^${external}.*$`));

module.exports = Object.assign({}, common({no_minify: true}), {
devtool: false,
entry: "./src/js/hypergrid.js",
output: {
filename: "perspective-viewer-plugin-hypergrid.js",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "../../cjs")
},
externals: [
function(context, request, callback) {
for (let external of externals) {
if (external.test(request)) {
return callback(null, "commonjs " + request);
}
}
callback();
}
]
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

const {COLUMN_SEPARATOR_STRING} = require("@jpmorganchase/perspective/src/js/defaults.js");
const COLUMN_SEPARATOR_STRING = "|";

const TREE_COLUMN_INDEX = require("fin-hypergrid/src/behaviors/Behavior").prototype.treeColumnIndex;

Expand Down
7 changes: 5 additions & 2 deletions packages/perspective-viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@
"name": "@jpmorganchase/perspective-viewer",
"version": "0.2.12",
"description": "Perspective.js",
"main": "src/js/viewer.js",
"main": "cjs/perspective-viewer.js",
"files": [
"build/**/*",
"cjs/*",
"src/**/*",
"babel.config.js"
],
"scripts": {
"bench": "npm-run-all bench:build bench:run",
"bench:build": "echo \"No Benchmarks\"",
"bench:run": "echo \"No Benchmarks\"",
"build:webpack": "webpack --color --config src/config/view.config.js",
"build:cjs": "webpack --color --config src/config/view.cjs.config.js",
"build:umd": "webpack --color --config src/config/view.config.js",
"build:themes": "webpack --color --config src/config/themes.config.js && rm build/__themes.js",
"build": "npm-run-all build:*",
"watch": "webpack --color --watch --config src/config/view.config.js",
Expand Down Expand Up @@ -49,6 +51,7 @@
"babel-polyfill": "^6.26.0",
"babel-runtime": "^6.26.0",
"d3-array": "^1.2.1",
"detectie": "1.0.0",
"mobile-drag-drop": "^2.2.0",
"underscore": "^1.8.3"
}
Expand Down
25 changes: 25 additions & 0 deletions packages/perspective-viewer/src/config/view.cjs.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const path = require("path");
const common = require("@jpmorganchase/perspective/src/config/common.config.js");
const {dependencies} = require("../../package.json");

const externals = Object.keys(dependencies).map(external => new RegExp(`^${external}.*$`));

module.exports = Object.assign({}, common({no_minify: true}), {
devtool: false,
entry: "./src/js/viewer.js",
output: {
filename: "perspective-viewer.js",
libraryTarget: "commonjs2",
path: path.resolve(__dirname, "../../cjs")
},
externals: [
function(context, request, callback) {
for (let external of externals) {
if (external.test(request)) {
return callback(null, "commonjs " + request);
}
}
callback();
}
]
});
2 changes: 1 addition & 1 deletion packages/perspective-viewer/src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

import {detectIE} from "@jpmorganchase/perspective/src/js/utils.js";
import detectIE from "detectie";

/**
* Instantiate a Template DOM object from an HTML text string.
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective-viewer/src/js/viewer/dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
*/

import {detectIE} from "@jpmorganchase/perspective/src/js/utils.js";
import detectIE from "detectie";

function calc_index(event) {
if (this._active_columns.children.length == 0) {
Expand Down
16 changes: 15 additions & 1 deletion packages/perspective/bench/js/bench.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const puppeteer = require("puppeteer");
const fs = require("fs");
const path = require("path");

const args = process.argv.slice(2);
const LIMIT = args.indexOf("--limit");

const multi_template = (xs, ...ys) => ys[0].map((y, i) => [y, xs.reduce((z, x, ix) => (ys[ix] ? z + x + ys[ix][i] : z + x), "")]);

const UNPKG_VERSIONS = ["0.2.11", "0.2.10", "0.2.9", "0.2.8", "0.2.7", "0.2.6", "0.2.5", "0.2.4", "0.2.3", "0.2.2", "0.2.1", "0.2.0"];
Expand Down Expand Up @@ -46,9 +49,20 @@ function transpose(json) {
}

async function run() {
// Allow users to set a limit on version lookbacks
let psp_urls = URLS;
console.log(`limit: ${LIMIT}`);
if (LIMIT !== -1) {
let limit_num = Number(args[LIMIT + 1]);
if (!isNaN(limit_num) && limit_num > 0 && limit_num <= psp_urls.length) {
console.log(`Benchmarking the last ${limit_num} versions`);
psp_urls = URLS.slice(0, limit_num);
}
}

let data = [],
version_index = 1;
for (let [version, url] of URLS) {
for (let [version, url] of psp_urls) {
let browser = await puppeteer.launch({
headless: true,
args: ["--auto-open-devtools-for-tabs", "--no-sandbox"]
Expand Down
2 changes: 2 additions & 0 deletions packages/perspective/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"core-js": "^2.5.7",
"css-loader": "^0.28.7",
"d3-array": "^1.2.1",
"detectie": "1.0.0",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^2.0.0",
"flatbuffers": "^1.10.2",
Expand All @@ -82,6 +83,7 @@
"uglifyjs-webpack-plugin": "^0.4.6",
"underscore": "^1.8.3",
"utf-8-validate": "~4.0.0",
"websocket-heartbeat-js": "^1.0.7",
"worker-loader": "^2.0.0",
"ws": "^6.1.2"
},
Expand Down
Loading

0 comments on commit f078f4d

Please sign in to comment.