Skip to content

Performance

For most graphs the defaults are fine. When a graph gets large, these are the knobs that matter, roughly in order of impact.

Renderer and layout

Use the WebGL renderer and the GPU layout for large graphs - they're the biggest wins. The CPU force layout also runs in a web worker by default, keeping simulation off the main thread. (Loading Orb from a plain <script> tag falls back to main-thread simulation - install with a bundler to keep the worker.)

Render settings

Pass these under render:

SettingDefaultNotes
labelsIsEnabledtrueLabels are expensive to draw; disable for large graphs.
labelsOnEventIsEnabledtrueShow labels only on hover/select instead of always.
shadowIsEnabledtrueShadows are expensive too; disable for large graphs.
shadowOnEventIsEnabledtrueShow shadows only on hover/select.
fps60Cap the frame rate to save CPU.
devicePixelRationullnull follows the screen; set a fixed value (e.g. 1) to draw fewer pixels on HiDPI displays.
minZoom / maxZoom0.25 / 8Zoom bounds. Lower minZoom to fit very large graphs (see below).
fitZoomMargin0.2Padding used by recenter when fitting the graph.
typescript
const orb = new OrbView(container, {
  render: { type: 'webgl', labelsIsEnabled: false, shadowIsEnabled: false, minZoom: 0.001 },
  layout: { type: 'force', options: { useGPU: true } },
});

Fitting large graphs

recenter can't zoom out past minZoom. A big graph may need a lower value (e.g. minZoom: 0.001) to fit fully in the viewport.

Selection dimming

On hover or selection, Orb dims everything else. Tune or disable it under render:

SettingDefaultNotes
contextAlphaOnEvent0.3Opacity of the dimmed (non-selected) objects.
contextAlphaOnEventIsEnabledtrueSet false to keep everything fully opaque.

Other

  • areCoordinatesRounded (default true) floors the pointer's canvas coordinates when hit-testing and dragging, which avoids aliasing on interaction.
  • When updating many objects at once, pass { isNotifySkipped: true } to setStyle / setPosition and call orb.render() once at the end, instead of re-rendering per change.

Released under the Apache-2.0 License.