$T_{server}=t_{signal}+t_{serialization}+t_{image\: calc}+t_{pull} + t_{display}$
multiply by $n$ interactions
$\begin{align}T_{client} &< T_{server}\end{align}$
\[\begin{align}n \cdot t_{client} + \frac{data_{dataset}}{r} &< n \cdot \bigg[t_{server} + \frac{data_{image}}{r}\bigg]\end{align}\]
where \[ \begin{align} n &= \mbox{the total number of interactions} \\ r &= \mbox{the data transfer rate} \\ t_{client} &= \mbox{the total time to compute an image on the client} \\ t_{server} &= \mbox{the total time to compute an image on the server} \\ \end{align} \]
\[\begin{align}n \cdot t_{client} + \frac{data_{dataset}}{r} &< n \cdot \bigg[t_{server} + \frac{data_{image}}{r}\bigg]\end{align}\]
↑ $n$
↑ $data_{image}$
↓ $t_{client}$
With a single, fixed, up-front cost we eliminate the requirement to transfer n images between the server and client
This is useful in some, but not all cases
#[wasm_bindgen]
pub struct VariableMesh {
px: Vec,
py: Vec,
pdx: Vec,
pdy: Vec,
val: Vec,
}
#[wasm_bindgen]
impl VariableMesh {
pub fn new(
px: Vec,
py: Vec,
pdx: Vec,
pdy: Vec,
val: Vec,
) -> VariableMesh {
VariableMesh {
px,
py,
pdx,
pdy,
val,
}
}
}
/* tslint:disable */
import * as wasm from './yt_tools_bg';
function passArrayF64ToWasm(arg) {
const ptr = wasm.__wbindgen_malloc(arg.length * 8);
getFloat64Memory().set(arg, ptr / 8);
return [ptr, arg.length];
}
export class VariableMesh {
static __construct(ptr) {
return new VariableMesh(ptr);
}
constructor(ptr) {
this.ptr = ptr;
}
free() {
const ptr = this.ptr;
this.ptr = 0;
wasm.__wbg_variablemesh_free(ptr);
}
static new(arg0, arg1, arg2, arg3, arg4) {
const [ptr0, len0] = passArrayF64ToWasm(arg0);
const [ptr1, len1] = passArrayF64ToWasm(arg1);
const [ptr2, len2] = passArrayF64ToWasm(arg2);
const [ptr3, len3] = passArrayF64ToWasm(arg3);
const [ptr4, len4] = passArrayF64ToWasm(arg4);
return VariableMesh.__construct(wasm.variablemesh_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4));
}
}
we are on PyPI
doesn't require Rust
doesn't requre you to compile to webassembly
pip install yt_pycanvas
jupyter nbextension enable --py --sys-prefix yt_pycanvas
git clone https://github.com/data-exp-lab/yt-canvas-widget
git clone https://github.com/data-exp-lab/rust-yt-tools
cd ./rust-yt-tools
wasm-pack init --scope data-exp-lab
cd ../yt-canvas-widget/js/
npm install --save ../../rust-yt-tools/pkg/
npm install
cd ../
pip install -e .
jupyter nbextension install --py --symlink --sys-prefix yt_pycanvas
jupyter nbextension enable --py --sys-prefix yt_pycanvas
**it's never this easy