A streaming-first, columnar analytics and cross-filtering engine for browsers and Node.js.
crossfilter3 builds on crossfilter2 and re-engineers the core for modern columnar analytics and interactive dashboards. It delivers 1 ms multi-chart cross-filtering at 1M rows via an automatic zero-copy WebAssembly 128-bit SIMD engine, sub-millisecond 60fps range brushing, zero row-object materialization, unlimited dimensions (removing the 32-dimension cap), and a streaming Apache Arrow Web Worker — while keeping 100% compatibility with the classic crossfilter API.
- Automatic zero-copy WASM-SIMD acceleration (
wasm: 'auto') — stays on lightweight pure JS for small datasets (< 16,384rows, zero WASM compile or memory overhead) and automatically activates a WASM-resident 128-bit SIMD engine (80inline kernels, zero external.wasmfetch) at≥ 16,384rows — including seamless mid-session promotion during streaming growth. - 1 ms interactive queries at 1M rows — single-dim clicks run in
0.35 ms(100K) /1.04 ms(1M), clearing filters takes0.24 ms, 2-dimrowCount()runs in0.24 ms, discrete brushing runs at0.028 ms/frame, and 60-frame continuous float brushing averages0.33 ms/frame(including cube build) at 1M rows. - Zero-copy columnar ingest & unlimited dimensions — ingest TypedArrays, Apache Arrow tables/IPC streams (with zero-copy Arrow Dictionary merging across streaming batches), or plain JS arrays without allocating row objects; per-dimension 1-bit bitsets remove crossfilter2's 32-dimension limit.
- Declarative dashboard runtime — configure KPIs (
count,sum,avg,avgNonZero,ratio), grouped charts, time bucketing, split-field breakdowns (including Falcon-accelerated split-chart brushing), top-K group queries, cached unfiltered bounds, and paged columnar rows in a singlequery()call. - Non-blocking Arrow IPC Web Worker — streams, decodes, joins lookup tables, and emits progressive partial snapshots off the main thread, returning Transferable TypedArray buffers zero-copy.
- Drop-in
crossfilter2compatible — existingcf.dimension(),group(), andreduce()code works unchanged, with bundled TypeScript definitions (index.d.ts) and ESM, CommonJS, and UMD builds (~81 kB min+gzip).
Measured on Node.js v22 using the built crossfilter.cjs bundle with default wasm: 'auto' on a multi-chart dashboard (6 groups × 4 metrics: count, sum(revenue), sum(cost), ratio(clicks, impressions) + KPIs; 5,000 SKUs, 365 days, and continuous floats):
| Workload | 100K rows | 1M rows | How it stays fast |
|---|---|---|---|
| Build + initial snapshot (6 dims, 6 groups) | 10.0 ms | 115.1 ms | Fast numeric dict encoder + WASM-SIMD AoS shared-scan |
| Build + initial snapshot (20 dims, 4 groups) | 5.5 ms | 55.9 ms | Lazy filter-only dims (0 CPU / 0 bytes until used) |
| Single-dim click (10% active) + full snapshot | 0.35 ms | 1.04 ms | i32x4 SIMD bitset packing + v128 sparse extract + co-scan |
| Clear filter → 100% + full snapshot | 0.25 ms | 0.24 ms | Copy-on-Write unfiltered snapshot restore (O(slots)) |
High-selectivity 95% (in 19/20) + clear |
0.63 ms | 1.56 ms | i8x16.swizzle 128-bit LUT + complement subtraction (f64x2) |
| Low-selectivity 0.5% (2 active dims) + clear | 0.58 ms | 1.65 ms | v128.and + v128.any_true zero-skip + i64.ctz + co-scan |
rowCount() with 2-dim filter update |
0.032 ms | 0.24 ms | WASM SIMD v128.and + i8x16.popcnt over 1-bit words |
| Discrete range brush (60f avg / steady-state) | 0.078 / 0.024 ms/f | 0.21 / 0.028 ms/f | WASM-SIMD Falcon prefix-sum cube (f64x2.sub, 0 row scans) |
| Continuous float brush (60f avg incl. cube build) | 0.055 ms/f | 0.33 ms/f | O(1) arithmetic / quantile bins + WASM-SIMD Falcon + CSR |
At 1M rows,
v3.3.0's automatic WASM-SIMD engine is 2.5× faster on clicks, 2.3× faster on 2-dim queries, 7.1× faster onrowCount(), 4.9× faster on 60-frame continuous brushing, and 4.3× faster on split-chart brushing thanv3.2.1pure JS (with identical numeric digests). Compared to pre-columnarcrossfilter3@3.0.3, clicks are 300×–800× faster and brushing is over 1,000× faster. See Under the hood for architecture and memory details.
npm install crossfilter3If you stream or ingest Apache Arrow tables/IPC, install apache-arrow alongside it (optional — not required for TypedArray columns or JS object arrays):
npm install crossfilter3 apache-arrowBrowser Web Worker setup (Next.js / Vite / static hosting)
createStreamingDashboardWorker loads UMD bundles inside the worker via importScripts (unless you supply a custom workerFactory). Copy the UMD builds into your static assets directory (e.g. public/vendor/):
{
"scripts": {
"postinstall": "mkdir -p public/vendor && cp node_modules/crossfilter3/crossfilter.js public/vendor/ && cp node_modules/apache-arrow/Arrow.es2015.min.js public/vendor/"
}
}Then pass /vendor/crossfilter.js and /vendor/Arrow.es2015.min.js as crossfilterUrl and arrowRuntimeUrl.
Pass column arrays directly — no row objects, no Arrow dependency, and instant sub-millisecond cross-filtering:
import crossfilter from 'crossfilter3';
const day = (n) => Date.UTC(2025, 0, 1 + n);
const runtime = crossfilter.createDashboardRuntime({
columns: {
country: ['US', 'UK', 'US', 'DE', 'US', 'UK'],
channel: ['web', 'app', 'app', 'web', 'web', 'web'],
time: new Float64Array([day(0), day(0), day(1), day(1), day(2), day(2)]),
revenue: new Float64Array([120, 80, 95, 60, 210, 150]),
clicks: new Int32Array([12, 8, 9, 4, 21, 15]),
impressions: new Int32Array([200, 160, 150, 100, 300, 250]),
},
// Filter-only dimensions stay deferred (0 cost) until actually filtered or queried
dimensions: ['country', 'channel', 'time', 'revenue'],
kpis: [
{ id: 'orders', op: 'count' },
{ id: 'revenue', field: 'revenue', op: 'sum' },
// Re-derived locally as sum(clicks) / sum(impressions) on every filter
{ id: 'ctr', field: 'clicks', denominator: 'impressions', op: 'ratio' },
],
groups: [
{
id: 'byCountry',
field: 'country',
metrics: [
{ id: 'orders', op: 'count' },
{ id: 'revenue', field: 'revenue', op: 'sum' },
],
},
{
id: 'timelineByChannel',
field: 'time',
bucket: { type: 'timeBucket', granularity: 'day' },
splitField: 'channel',
metrics: [{ id: 'revenue', field: 'revenue', op: 'sum' }],
},
],
});
// Single atomic query: apply filters + read KPIs, shaped groups, bounds, rowCount, and paged rows
const res = runtime.query({
filters: {
country: { type: 'in', values: ['US', 'UK'] },
time: { type: 'range', range: [day(0), day(2)] },
},
snapshot: {
groups: {
byCountry: { sort: 'desc', sortMetric: 'revenue', limit: 10, visibleOnly: true, includeTotals: true },
},
},
bounds: { fields: ['revenue'] },
rowCount: true,
rows: {
sortBy: 'revenue',
direction: 'top',
limit: 50,
fields: ['country', 'channel', 'revenue'],
columnar: true, // returns TypedArray/column slices instead of JS row objects
},
});
res.snapshot.kpis; // { orders: 3, revenue: 295, ctr: 0.05686... }
res.snapshot.groups.byCountry; // { entries: [...], total: 3, sort: 'desc', ... } (ignores country's own filter)
res.bounds.revenue; // { min: 80, max: 120 }
res.rowCount; // 3
res.rows; // { fields: [...], length: 3, columns: { country: [...], ... } }
runtime.dispose();Stream large Arrow IPC responses directly inside a Web Worker with progressive snapshots and zero-copy Transferable payloads back to the main thread:
import crossfilter from 'crossfilter3';
const runtime = await crossfilter.createStreamingDashboardWorker({
crossfilterUrl: '/vendor/crossfilter.js',
arrowRuntimeUrl: '/vendor/Arrow.es2015.min.js',
emitSnapshots: true,
batchCoalesceRows: 65536,
dimensions: ['event', 'country', 'region', 'time'],
kpis: [
{ id: 'count', field: 'count', op: 'sum' },
{ id: 'hitRate', field: 'hits', denominator: 'attempts', op: 'ratio' },
],
groups: [
{ id: 'byEvent', field: 'event', metrics: [{ id: 'count', field: 'count', op: 'sum' }] },
{ id: 'byCountry', field: 'country', metrics: [{ id: 'count', field: 'count', op: 'sum' }] },
{
id: 'timeline',
field: 'time',
bucket: { type: 'timeBucket', granularity: 'month' },
metrics: [{ id: 'count', field: 'count', op: 'sum' }],
},
],
sources: [{
id: 'primary',
role: 'base',
dataUrl: '/api/cube',
dataFetchInit: {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ format: 'arrow', query: { /* ... */ } }),
},
projection: {
rename: {
'events.count': 'count',
'events__timestamp_month': 'time',
'events.event': 'event',
'events.country': 'country',
'events.region': 'region',
},
transforms: {
count: 'number',
time: 'timestampMs',
},
},
}],
});
runtime.on('progress', (progress) => {
console.log(progress.status, progress.load.rowsLoaded, 'rows', progress.fetch.percent, '%');
});
runtime.on('snapshot', ({ snapshot }) => {
renderCharts(snapshot.groups);
renderKpis(snapshot.kpis);
});
await runtime.ready;
const result = await runtime.query({
filters: {
country: { type: 'in', values: ['US', 'UK'] },
time: { type: 'range', range: [startMs, endMs] },
},
rows: {
sortBy: 'time',
direction: 'top',
limit: 50,
fields: ['event', 'country', 'region', 'time', 'count'],
columnar: true,
},
});Tip: Send categorical columns as Arrow Dictionary vectors whenever your backend supports it —
crossfilter3ingests Arrow Dictionary codes directly without JS string hashing and merges dictionary batches zero-copy acrossbatchCoalesceRowsstreaming flushes, cutting 1M-row load time by ~3×.
import crossfilter from 'crossfilter3';
import { tableFromIPC } from 'apache-arrow';
// Synchronous Arrow table runtime (no worker)
const table = tableFromIPC(new Uint8Array(arrowBuffer));
const runtime = crossfilter.createDashboardRuntime({
table,
dimensions: ['country', 'event', 'time'],
groups: [{ id: 'byCountry', field: 'country', metrics: [{ id: 'count', op: 'count' }] }],
kpis: [{ id: 'total', op: 'count' }],
});
const snap = runtime.snapshot({ country: { type: 'in', values: ['US'] } });import crossfilter from 'crossfilter3';
// Classic crossfilter2 API + columnar & batch extensions
const cf = crossfilter.fromColumns(columns); // or crossfilter(records)
const country = cf.dimension('country');
const revenue = cf.dimension('revenue');
const byCountry = country.group().reduceCount();
// Atomic multi-dimension filter transition (coalesces listener updates)
cf.batch(() => {
country.filterIn(['US', 'UK']);
revenue.filterRange([100, 500]);
});
const topIndexes = revenue.topIndex(20);
const topCols = cf.takeColumns(topIndexes, ['country', 'revenue']);{ type: 'exact', value: 'click' } // exact match
{ type: 'in', values: ['click', 'purchase'] } // set membership
{ type: 'range', range: [startMs, endMs] } // half-open [min, max)
{ type: 'all' } // or null // clear filter on this fieldA single runtime.query(...) call can combine:
filters— updates active global filters before reading results.isolatedFilters— evaluates the query under a temporary filter state without mutating the dashboard's active filters (useful for comparison cards or drill-down previews).snapshot—{ groups: { [groupId]: GroupQuery | false } }to shape/paginate specific groups, orfalseto skip snapshots entirely.groups— ad-hoc shaped group reads without recomputing KPIs.rows/rowSets— single or multiple named paged row slices; passcolumnar: truefor zero-copy{ columns, fields, length }output (omittingcolumnarreturns an array of row objects).bounds—{ fields: ['revenue', 'time'] }returns{ min, max }across currently filtered rows (cached inO(1)when unfiltered, invalidated automatically on append/remove).rowCount: true— returns the exact filtered row count via WASM 128-bit SIMDi8x16.popcnt(with branchless JS SWAR popcount fallback).
Append new rows or prune filtered records without rebuilding the runtime:
// Async worker runtime
await runtime.append([
{ event: 'click', country: 'US', region: 'CA', time: Date.now(), count: 1 },
]);
await runtime.removeFiltered('excluded'); // or 'included'
// Sync runtime also supports zero-copy columnar & Arrow appends
runtime.appendColumns(nextColumns);
runtime.appendArrowTable(nextArrowTable);crossfilter3 ships an inline, zero-dependency WebAssembly 128-bit SIMD engine (80 kernels compiled from in-memory bytes — no external .wasm files or network fetches). By default (wasm: 'auto'), it activates automatically wherever it is beneficial:
- Below
16,384rows: stays on pure JS with zero WASM compile time or linear-memory allocation. - At
≥ 16,384rows (when 128-bit SIMD is supported): lazily initializes a per-instance linear-memory arena, reserves proportional capacity upfront (capped at 128 MB) to eliminate mid-querymemory.grow()stalls, and runs filter packing, bitset popcount/extraction, multi-group co-scans, and Falcon brush cubes directly inside WASM memory with zero per-query copying. - Seamless streaming promotion & latching: if a dataset starts small (
< 16,384rows) and grows pastwasmThresholdviaappend()/appendColumns()/ streaming batches, existing filter bitsets, dictionary codes, numeric columns, and metric accumulators promote transparently into the WASM arena. Once active on an instance, WASM stays latched even ifremoveFiltered()later shrinks row count below threshold. - Automatic fallback: environments without 128-bit WASM SIMD stay on pure JS in
'auto'mode (explicitwasm: truestill runs scalar WASM if requested).
import crossfilter from 'crossfilter3';
// Default ('auto'): pure JS below 16,384 rows, WASM-SIMD at >= 16,384 rows
const rt = crossfilter.createDashboardRuntime({ columns, dimensions, groups, kpis });
// Inspect active engine state on any dashboard runtime or crossfilter instance
rt.runtimeInfo();
// {
// active: 'wasm', // 'wasm' or 'js' right now for this instance
// wasmMode: 'auto', // 'auto' | 'on' | 'off'
// wasmEnabled: true, // false only when wasmMode === 'off'
// wasmThreshold: 16384, // auto-activation row threshold
// simdSupported: true, // 128-bit WASM SIMD probed at runtime
// wasmSupported: true,
// lastError: null
// }
// Per-instance overrides (isolated; never mutate sibling instances or global defaults)
crossfilter.createDashboardRuntime({ columns, dimensions, groups, kpis, wasm: false }); // force pure JS
crossfilter.createDashboardRuntime({ columns, dimensions, groups, kpis, wasm: true }); // force WASM even for tiny tables
crossfilter.createDashboardRuntime({ columns, dimensions, groups, kpis, wasmThreshold: 8192 }); // custom auto threshold
// Classic crossfilter instance or global defaults
const cf = crossfilter.fromColumns(columns);
cf.configureRuntime({ wasm: 'auto', wasmThreshold: 8192 });
crossfilter.configureRuntime({ wasm: false }); // affects newly created instances onlyCleanup & CSP notes: Always call
runtime.dispose()when unmounting a dashboard so WASM arena handles are released and GC can reclaim the instance'sWebAssembly.Memory. Because the module is compiled from inline bytes, strict Content-Security-Policy headers require'wasm-unsafe-eval'for WASM acceleration — in environments that disallow WASM entirely, passwasm: false(orcrossfilter.configureRuntime({ wasm: false })).
Measured sequentially on Node.js v22 with the built crossfilter.cjs bundle (100% identical numeric digests across every scenario):
| 1M-row workload | Pure JS (wasm: false) |
WASM-SIMD (wasm: 'auto') |
Speedup |
|---|---|---|---|
| Single-dim click (10% active) + full snapshot | 2.61 ms | 1.04 ms | 2.5× |
High-selectivity 95% (in 19/20) + clear |
2.63 ms | 1.63 ms | 1.6× |
| Low-selectivity 0.5% (2 dims) + clear | 3.70 ms | 1.63 ms | 2.3× |
rowCount() with 2-dim filter update |
1.81 ms | 0.24 ms | 7.5× |
| Discrete brush 60f (cold + warm total) | 61.6 ms | 12.4 ms | 5.0× |
| Continuous float brush w/ 5K SKUs (steady per frame) | 6.71 ms/f | 1.68 ms/f | 4.0× |
Split-chart brush 20f (dense splitField Falcon) |
40.8 ms | 24.0 ms | 1.7× |
| Streaming 16 × 62.5K (16 progressive snapshots / total) | 61.0 / 166.9 ms | 27.5 / 140.3 ms | 2.2× snaps |
(Cold one-time build of 1M JS arrays is slightly faster in pure JS — 86 ms vs 108 ms — due to one-time linear memory allocation/mirroring, which is repaid by the first click or brush.)
| Option | Type | Default | Description |
|---|---|---|---|
columns |
Record<string, ColumnSource> |
— | Columnar arrays / TypedArrays (mutually exclusive with table, records) |
table |
ArrowTableLike |
— | Apache Arrow Table (mutually exclusive with columns, records) |
records |
TRecord[] |
— | Plain JS row objects (mutually exclusive with columns, table) |
columnarOptions |
ColumnarOptions |
— | Optional { fields, length, transforms, rowFactory } |
dimensions |
string[] |
[] |
Filterable field names (group fields are added automatically) |
groups |
DashboardGroupSpec[] |
[] |
Declarative group-by specs (see below) |
kpis |
DashboardMetricSpec[] |
[] |
Global aggregate metric specs (see below) |
wasm |
'auto' | boolean |
'auto' |
'auto' activates zero-copy WASM-SIMD at ≥ wasmThreshold rows when 128-bit SIMD is supported; true forces WASM; false forces pure JS |
wasmThreshold |
number |
16384 |
Row threshold at which wasm: 'auto' activates WASM-SIMD (latched once active) |
Single-shot (non-streaming) Apache Arrow IPC Web Worker accepting dimensions, groups, kpis, wasm, wasmThreshold, crossfilterUrl, arrowRuntimeUrl, workerFactory, and exactly one of dataUrl (with optional dataFetchInit) or arrowBuffer. Resolves to an AsyncDashboardRuntime once the Arrow payload is decoded and indexed.
Accepts dimensions, groups, kpis, wasm, and wasmThreshold above, plus:
| Option | Type | Default | Description |
|---|---|---|---|
crossfilterUrl |
string |
— | URL to the UMD build (crossfilter.js) |
arrowRuntimeUrl |
string |
— | URL to Apache Arrow UMD (Arrow.es2015.min.js) |
sources |
DashboardStreamSource[] |
— | Arrow IPC base and lookup sources (see below) |
emitSnapshots |
boolean |
false |
Emit throttled partial snapshots during streaming load |
initialFilters |
DashboardFilterState |
null |
Filters applied as batches stream in |
batchCoalesceRows |
number |
65536 |
Rows buffered before flushing a coalesced batch into crossfilter |
maxRows |
number |
— | Optional positive safe integer cap across base and lookup sources (checked before projection/ingest) |
maxBytes |
number |
— | Optional positive safe integer cap on encoded input bytes (bounded fetches require a readable body) |
progressThrottleMs |
number |
100 |
Minimum interval between 'progress' events |
snapshotThrottleMs |
number |
250 |
Minimum interval between streaming 'snapshot' events |
workerFactory |
() => Worker |
— | Custom worker factory (skips importScripts) |
| Field | Type | Description |
|---|---|---|
id |
string |
Unique source identifier |
role |
'base' | 'lookup' |
One 'base' source required; 'lookup' sources are joined in the worker |
dataUrl |
string |
URL to fetch the Arrow IPC stream |
dataFetchInit |
RequestInit |
Fetch options (method, headers, body, etc.) |
arrowBuffer |
ArrayBuffer | ArrayBufferView |
Pre-loaded Arrow IPC buffer (alternative to dataUrl) |
lookup |
{ keyFields: string[], valueFields: string[] } |
Join keys and columns to attach for 'lookup' sources |
projection.rename |
Record<string, string> |
Rename incoming Arrow columns to internal field names |
projection.transforms |
Record<string, Transform> |
Coerce columns: 'timestampMs', 'number', 'boolean' ('true'/'false'/null), 'constantOne' |
| Field | Type | Description |
|---|---|---|
id |
string |
Group identifier in snapshot.groups[id] (defaults to group_<index>) |
field |
string |
Dimension field to group by |
bucket |
{ type: 'timeBucket', granularity: 'minute' | 'hour' | 'day' | 'week' | 'month' } |
Optional UTC time bucketing |
splitField |
string |
Optional secondary dimension producing nested { [splitKey]: metrics } values |
metrics |
DashboardMetricSpec[] |
Metrics computed per bucket (defaults to row count) |
sortMetric |
string |
Default metric ID used when sorting this group |
| Option | Type | Default | Description |
|---|---|---|---|
sort |
'desc' | 'asc' | 'natural' |
'desc' |
Sort by sortMetric or natural key order |
sortMetric |
string |
group default | Metric ID used for 'asc'/'desc' ordering |
limit |
number | null |
null |
Max entries returned (uses top-K min/max heap when smaller than cardinality) |
offset |
number |
0 |
Pagination offset |
visibleOnly |
boolean |
false |
Exclude buckets with zero contributing rows |
includeTotals |
boolean |
false |
Include total count of matching buckets before pagination |
nonEmptyKeys |
boolean |
false |
Exclude null, undefined, and "" keys |
keys |
Array |
— | Restrict output to an allowlist of keys |
includeKeys |
Array |
— | Always include these keys even if outside limit (e.g. currently selected items) |
search |
string |
— | Case-insensitive substring filter on bucket keys |
| Field | Type | Description |
|---|---|---|
id |
string |
Output key (snapshot.kpis[id], entry.value[id]) |
op |
'count' | 'sum' | 'avg' | 'avgNonZero' | 'ratio' |
Aggregation operator |
field |
string |
Numeric column to aggregate (omitted for 'count'; numerator for 'ratio') |
denominator |
string |
Required for 'ratio': numeric column summed as the divisor |
ratiometrics sumfieldanddenominatorindependently and finalize tosum(field) / sum(denominator)(ornullwhen the denominator is0). Rates and weighted averages re-derive accurately from pre-aggregated rows entirely client-side on every filter with no server re-query.
All methods below exist on both DashboardRuntime (synchronous return) and AsyncDashboardRuntime (returns Promise<...>):
| Method | Description |
|---|---|
query(request) |
Apply filters (or isolatedFilters), return { snapshot, rows, rowSets, groups, bounds, rowCount } |
snapshot(filters?, options?) |
Compute KPIs and groups without fetching row pages |
groups(request?) |
Read/shape one or more groups directly |
rows(query?) / rowSets(request?) |
Fetch single or multiple named paged row slices (object or columnar) |
bounds(request?) |
Compute { min, max } over active rows for requested fields |
rowCount(request?) |
Return active row count |
updateFilters(filters?) |
Update active filters without reading results |
reset() |
Clear all active filters |
append(records) |
Append JS row objects and return new dataset size (sync also exposes appendColumns, appendArrowTable) |
removeFiltered(selection?) |
Remove 'included' or 'excluded' rows and return new dataset size |
createGroup(spec) / disposeGroup(id) |
Add or remove a group dynamically at runtime |
runtimeInfo() |
Inspect active runtime acceleration ({ active, wasmMode, wasmEnabled, wasmThreshold, simdSupported, wasmSupported, lastError }) |
dispose() |
Release listeners/caches (and terminate the Web Worker for async runtimes) |
ready / on(event, fn) (streaming worker) |
Promise resolving on load complete; subscribe to 'progress', 'snapshot', 'ready', 'error' |
Arrow IPC / TypedArray columns / JS records
│
▼ (optional Web Worker: fetch → Arrow RecordBatchReader → zero-copy Dict merge + lookup join)
Columnar Store (zero-copy Float64Array views + lazy Proxy row array)
│
├──► Runtime Policy (wasm: 'auto') (pure JS < 16,384 rows; latched WASM-SIMD arena ≥ 16,384 rows)
├──► Lazy Filter-Only Dimensions (0 work until first filter / group / bounds / sort)
├──► 1-Bit Columnar Filter Bitsets (N/8 B per active filter, no 32-dim cap, i8x16.swizzle / v128 popcnt)
├──► Falcon Prefix-Sum Brush Cache (auto on 2nd consecutive range/exact brush; flat & dense splitField)
└──► AoS Multi-Group Co-Scheduler (interleaved Float64Array, up to 5 groups + KPI in 1 pass,
incremental unfiltered streaming + complement subtraction >50% active)
│
▼ (postMessage with Transferable TypedArrays in worker mode)
UI / Charts (renders snapshots & columnar row slices only)
- Zero-copy WASM-resident 128-bit SIMD engine (
wasm: 'auto') —src/wasm-simd.jscompiles an inline, zero-dependency WebAssembly module (80 kernels; runtime SIMD probe with scalar fallback) whose linear memory arena holds column codes, filter bitsets, metric accumulators, and Falcon prefix cubes directly so JS never copies data per query. In default'auto'mode, datasets below16,384rows stay on pure JS (0 WASM compile/memory cost); datasets at≥ 16,384rows (or streaming datasets that grow past the threshold) seamlessly promote existing columns, bitsets, and metric buffers into the WASM arena and latch on. Passwasm: true,wasm: false, orwasmThresholdper instance or globally viacrossfilter.configureRuntime(...). - 1-bit columnar filter bitsets — Each active filter owns a packed
Uint32Array(1 bit/row, bit1= included); clearing a filter isO(1)and there is no 32-dimension limit. Filter packing usesi32x4.eq,i8x16.swizzle128-bit lookup tables (for≤ 128distinct codes), andf64x2range predicates; sparse extraction usesv128.any_true128-bit zero-skip +i64.ctz(JS fallback:Math.clz32);rowCount()usesv128.and+i8x16.popcnt(JS fallback: SWARpopcount32). - Copy-on-Write unfiltered cache, incremental streaming & complement subtraction — Unfiltered group buffers are cached copy-on-write and extended incrementally on unfiltered streaming appends (only new rows
[oldN..newN)are scanned). Clearing back to 100% is anO(slots)restore. When> 50%of rows remain active, groups restore the unfiltered cache and subtract only excluded rows (f64x2.sub), guarded against floating-point cancellation (abs(v) > 1e12) and with exact empty-slot zeroing. - Interleaved AoS buffers + multi-group co-scan — All metrics for a group slot live contiguously on one cache line in a single
Float64Array. Dirty groups sharing a metric plan are reduced together (up to 5 groups + KPI per pass) through specialized WASM-SIMD (f64x2.add/sub) and V8-friendly JS leaf kernels. - Lazy filter-only dimensions & zero-copy Arrow ingest — Declared filter dimensions on columnar data defer dictionary/numeric indexing across init, snapshots, appends, and
dispose(). Streaming Arrow Dictionary columns merge dictionary tables zero-copy across coalesced batches without decoding strings, and numeric columns use a step-aligned dense LUT + IEEE-754 bit-hashed dictionary encoder. - End-to-end Falcon prefix-sum brush cache — Activates automatically on the 2nd consecutive
filterRange/filterExacton the same dimension while other filters stay fixed (0 overhead on single clicks), supporting both standard and densesplitFieldgroups. Discrete dimensions (≤ 2,048unique values) answer inO(slots)with 0 row scans; continuous float dimensions use O(1) arithmetic / clipped-uniform binning (with IQR skew guard + quantile fallback), WASM-SIMD cube construction (falconCube0..6),f64x2prefix sums/slice subtraction, and CSR boundary bins.
| Component | Size for N rows | Example (100K rows) | Notes |
|---|---|---|---|
| Unused filter-only dimension | 0 bytes | 0 KB | Deferred until first filter, group, bounds, or sort access |
| Active filter bitset (1 bit/row) | N / 8 bytes |
12.5 KB | Allocated only while filtered; 0 KB when unfiltered; unlimited dims |
Dictionary codes (Uint32Array) |
4 × N bytes |
400 KB | Lives directly in WASM arena when active; grows 2× amortized on appends |
codeCounts + codeToValue |
~54 × U bytes |
~54 KB (1K distinct) | Shared with splitField when field matches a dimension |
Numeric column (Float64Array) |
0 B (JS) / 8 × N (WASM mirror) |
0 KB / 800 KB | Zero-copy view in JS mode; mirrored once into WASM arena when active |
| WASM-SIMD linear memory arena | 0 B (< 16K) / proportional (≥ 16K) |
~6 MB | Zero allocation below wasmThreshold; reclaimed on dispose() |
| Row objects (lazy Proxy array) | 0 bytes upfront | ~25 KB (50 visible) | vs. ~50 MB for 100K materialized 20-field JS objects |
- ESM:
import crossfilter from 'crossfilter3'→main.js - CommonJS:
const crossfilter = require('crossfilter3')→crossfilter.cjs - Browser UMD / CDN:
crossfilter.js/crossfilter.min.js - TypeScript:
index.d.ts(bundled automatically)
npm install
npm test # Vitest suite (698 tests incl. WASM-SIMD & differential fuzzing) + ESLint on src/
npm run build # Rollup -> crossfilter.js, crossfilter.cjs, crossfilter.min.js
npm run benchmark # Built-in 100K classic crossfilter benchmark
npm run benchmark:arrow # Arrow ingest & columnar benchmarkApache-2.0. Based on the original crossfilter by Mike Bostock and Jason Davies, and crossfilter2.