diff --git a/.github/actions/install-wheel/action.yaml b/.github/actions/install-wheel/action.yaml index 7b016f1266..f1a74c9c06 100644 --- a/.github/actions/install-wheel/action.yaml +++ b/.github/actions/install-wheel/action.yaml @@ -13,13 +13,23 @@ name: "Install wheel" description: "Installs the wheel depending on build platform, because Python" +inputs: + inplace: + default: "true" + description: "Install in-place?" + runs: using: "composite" steps: - name: Install wheel (Linux) shell: sh run: python -m pip install -U --no-dependencies *.whl --target rust/perspective-python - if: ${{ runner.os == 'Linux' }} + if: ${{ inputs.inplace == 'true' && runner.os == 'Linux' }} + + - name: Install wheel (Linux) + shell: sh + run: python -m pip install -U --no-dependencies *.whl + if: ${{ inputs.inplace != 'true' && runner.os == 'Linux' }} - name: Install wheel (OSX) shell: sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38469ac67a..aca567b473 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -625,6 +625,8 @@ jobs: name: perspective-python-dist-${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.python-version }} - uses: ./.github/actions/install-wheel + with: + inplace: "false" - name: Benchmarks run: pnpm run bench diff --git a/cpp/perspective/src/cpp/arrow_csv.cpp b/cpp/perspective/src/cpp/arrow_csv.cpp index 3413fcd37f..211811f0a9 100644 --- a/cpp/perspective/src/cpp/arrow_csv.cpp +++ b/cpp/perspective/src/cpp/arrow_csv.cpp @@ -609,11 +609,11 @@ csvToTable( auto read_options = arrow::csv::ReadOptions::Defaults(); auto parse_options = arrow::csv::ParseOptions::Defaults(); auto convert_options = arrow::csv::ConvertOptions::Defaults(); - #ifdef PSP_PARALLEL_FOR - read_options.use_threads = true; - #else - read_options.use_threads = false; - #endif +#ifdef PSP_PARALLEL_FOR + read_options.use_threads = true; +#else + read_options.use_threads = false; +#endif parse_options.newlines_in_values = true; if (is_update) { diff --git a/cpp/perspective/src/cpp/view.cpp b/cpp/perspective/src/cpp/view.cpp index 2db866c545..e310c65665 100644 --- a/cpp/perspective/src/cpp/view.cpp +++ b/cpp/perspective/src/cpp/view.cpp @@ -1211,11 +1211,11 @@ View::data_slice_to_arrow( options.codec = std::move(codec).ValueUnsafe(); } - #ifdef PSP_PARALLEL_FOR - options.use_threads = true; - #else - options.use_threads = false; - #endif +#ifdef PSP_PARALLEL_FOR + options.use_threads = true; +#else + options.use_threads = false; +#endif auto res = arrow::ipc::MakeStreamWriter(&sink, arrow_schema, options); std::shared_ptr writer = *res; diff --git a/examples/blocks/src/editable/index.html b/examples/blocks/src/editable/index.html index 3062436014..c87505fcf3 100644 --- a/examples/blocks/src/editable/index.html +++ b/examples/blocks/src/editable/index.html @@ -7,7 +7,6 @@ - diff --git a/examples/blocks/src/market/index.html b/examples/blocks/src/market/index.html index 0ac00ec6f1..9d1ee0467d 100644 --- a/examples/blocks/src/market/index.html +++ b/examples/blocks/src/market/index.html @@ -4,7 +4,6 @@ - diff --git a/examples/blocks/src/nypd/index.html b/examples/blocks/src/nypd/index.html index e1c048cc8b..e4ce554b81 100644 --- a/examples/blocks/src/nypd/index.html +++ b/examples/blocks/src/nypd/index.html @@ -3,7 +3,6 @@ - diff --git a/examples/blocks/src/raycasting/index.html b/examples/blocks/src/raycasting/index.html index b22b6e96f3..d3ed229a52 100644 --- a/examples/blocks/src/raycasting/index.html +++ b/examples/blocks/src/raycasting/index.html @@ -11,7 +11,6 @@ - diff --git a/examples/blocks/src/webcam/index.html b/examples/blocks/src/webcam/index.html index 42490ce63d..21b7492fc8 100644 --- a/examples/blocks/src/webcam/index.html +++ b/examples/blocks/src/webcam/index.html @@ -4,7 +4,6 @@ - diff --git a/examples/esbuild-example/src/index.html b/examples/esbuild-example/src/index.html index 182fa7ab27..37852b27ad 100644 --- a/examples/esbuild-example/src/index.html +++ b/examples/esbuild-example/src/index.html @@ -9,7 +9,6 @@ - diff --git a/packages/perspective-esbuild-plugin/index.js b/packages/perspective-esbuild-plugin/index.js index 6abe0cbf42..f97436d1ba 100644 --- a/packages/perspective-esbuild-plugin/index.js +++ b/packages/perspective-esbuild-plugin/index.js @@ -18,7 +18,6 @@ exports.PerspectiveEsbuildPlugin = function PerspectiveEsbuildPlugin( ) { const wasm_plugin = WasmPlugin(!!options.wasm?.inline); const worker_plugin = WorkerPlugin({ - inline: !!options.worker?.inline, targetdir: options.worker?.targetdir, }); diff --git a/packages/perspective-esbuild-plugin/worker.js b/packages/perspective-esbuild-plugin/worker.js index 064cbbed4b..c87e73009d 100644 --- a/packages/perspective-esbuild-plugin/worker.js +++ b/packages/perspective-esbuild-plugin/worker.js @@ -15,7 +15,6 @@ const path = require("path"); const esbuild = require("esbuild"); exports.WorkerPlugin = function WorkerPlugin(options = {}) { - const inline = !!options.inline; const targetdir = options.targetdir || "build/worker"; function setup(build) { const options = build.initialOptions; @@ -34,16 +33,17 @@ exports.WorkerPlugin = function WorkerPlugin(options = {}) { const subbuild = esbuild.build({ target: ["es2021"], entryPoints: [entryPoint], - outfile, + // outfile, define: { global: "self", }, entryNames: "[name]", chunkNames: "[name]", assetNames: "[name]", - minify: !process.env.PSP_DEBUG, + minify: true, bundle: true, - sourcemap: true, + sourcemap: false, + write: false, }); return { @@ -68,10 +68,9 @@ exports.WorkerPlugin = function WorkerPlugin(options = {}) { build.onLoad( { filter: /.*/, namespace: "worker-stub" }, async (args) => { - if (inline) { - return { - pluginData: args.pluginData, - contents: ` + return { + pluginData: args.pluginData, + contents: ` import worker from ${JSON.stringify(args.path)}; function make_host(a, b) { function addEventListener(type, callback) { @@ -126,82 +125,14 @@ exports.WorkerPlugin = function WorkerPlugin(options = {}) { export default initialize; `, - }; - } - - return { - pluginData: args.pluginData, - contents: ` - import worker from ${JSON.stringify(args.path)}; - async function get_worker_code() { - const url = new URL(__PSP_INLINE_WORKER__(worker), import.meta.url); - const req = await fetch(url); - const code = await req.text(); - return code; - }; - - function make_host(a, b) { - function addEventListener(type, callback) { - a.push(callback); - } - - function removeEventListener(callback) { - const idx = a.indexOf(callback); - if (idx > -1) { - a.splice(idx, 1); - } - } - - function postMessage(msg) { - for (const listener of b) { - listener({data: msg}); - } - } - - return { - addEventListener, - removeEventListener, - postMessage, - location: {href: ""} - } - } - - function run_single_threaded(code) { - let f = Function("const self = arguments[0];" + code); - const workers = []; - const mains = []; - f(make_host(workers, mains)); - return make_host(mains, workers); - } - - export const initialize = async function () { - const code = await get_worker_code(); - if (window.location.protocol.startsWith("file") && !window.isElectron) { - console.warn("file:// protocol does not support Web Workers"); - return run_single_threaded(code); - } - - try { - const blob = new Blob([code], {type: 'application/javascript'}); - const url = URL.createObjectURL(blob); - return new Worker(url, {type: "module"}); - } catch (e) { - console.warn("Failed to instantiate worker, falling back to single-threaded runtime", e); - return run_single_threaded(code); - } - }; - - export default initialize; - `, }; } ); build.onLoad({ filter: /.*/, namespace: "worker" }, async (args) => { // Get the subbuild output and delete the temp file - await args.pluginData.subbuild; - contents = await fs.promises.readFile(args.pluginData.outfile); - + const result = await args.pluginData.subbuild; + const contents = result.outputFiles[0].contents; // // Copy the sourcemaps also // const mapfile = args.pluginData.outfile + ".map"; // sourcemap = await fs.promises.readFile(mapfile); @@ -221,7 +152,7 @@ exports.WorkerPlugin = function WorkerPlugin(options = {}) { return { contents, - loader: inline ? "text" : "file", + loader: "text", }; }); diff --git a/rust/perspective-js/build.js b/rust/perspective-js/build.js index 63446a22ed..20ba7e9240 100644 --- a/rust/perspective-js/build.js +++ b/rust/perspective-js/build.js @@ -27,7 +27,6 @@ const BUILD = [ plugins: [ PerspectiveEsbuildPlugin({ wasm: { inline: true }, - worker: { inline: true }, }), ], outfile: "dist/esm/perspective.inline.js", diff --git a/rust/perspective-server/build/main.rs b/rust/perspective-server/build/main.rs index 2e03bd0b57..66145a44a7 100644 --- a/rust/perspective-server/build/main.rs +++ b/rust/perspective-server/build/main.rs @@ -18,6 +18,10 @@ use base64::prelude::*; use regex::{Captures, Regex}; fn main() -> Result<(), std::io::Error> { + if std::env::var("DOCS_RS").is_ok() { + return Ok(()); + } + let markdown = fs::read_to_string("./docs/lib.md")?; let markdown = Regex::new(" Result, std::io::Error> { ); } - if matches!(std::env::var("DOCS_RS").as_deref(), Ok("1")) { - return Ok(None); - } let mut dst = Config::new("cpp/perspective"); if cfg!(windows) && std::option_env!("CI").is_some() { diff --git a/tools/perspective-bench/src/js/benchmark.mjs b/tools/perspective-bench/src/js/benchmark.mjs index f94d7fd5e8..795b1f709e 100644 --- a/tools/perspective-bench/src/js/benchmark.mjs +++ b/tools/perspective-bench/src/js/benchmark.mjs @@ -194,11 +194,9 @@ async function benchmark_puppeteer_version(version, benchmarks_table) { - - `);