Repository navigation
Conversation
The next commits pass Float32Array data to regl-scatter2d without a copy. The pinned commit holds the changes that regl-scatter2d needs for that, and a built bundle.js. regl-scatter2d builds bundle.js at publish time, so a plain git commit holds no entry file. A regl-scatter2d release replaces this pin.
calc wrote x and y of each trace to a plain Array of doubles and built an Array of point ids. regl-scatter2d then copied the positions and uploaded 16 bytes for each point. Each restyle or moveTraces repeated the copies and the upload.
For a markers-only trace on linear axes with Float32Array data, calc now passes {x, y, count, rev} to regl-scatter2d. regl-scatter2d uploads 8 bytes for each point one time. The same buffer range with the same layout.datarevision is the same data. calc reads the axis extremes from a cache and builds the point ids at the first read.
If you refill a typed array in place, set a new layout.datarevision.
calc built a point-cluster tree for each trace of 100,000 points or more, at every calc. Only hoverPoints reads the tree. If layout.hovermode is false, or the trace has hoverinfo 'skip', the first read now builds the tree. With hover, calc builds the tree as before.
npm prepares a git dependency that has a build script. It installs the devDependencies of regl-scatter2d, which include the native gl package, and a plain npm ci fails where gl has no binary. The new pinned commit holds the same bundle.js and no build script, so npm ci needs no build.
This was referenced Dec 5, 2026
With virtual-webgl, regl gets a virtual context. That context calls functions that virtual-webgl copied from WebGLRenderingContext.prototype at load, so a later spy on that prototype records nothing, and four upload specs failed in the virtual-webgl job. The specs now spy on the prototype of the context itself. Without virtual-webgl, that prototype is WebGLRenderingContext.prototype as before.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A markers-only
scattergltrace withFloat32Arrayxandynow goes to the GPU without a copy. With 20 million points andhovermode: false, a recolor takes 111 ms instead of 3,778 ms. With hover on, a recolor takes 3,265 ms instead of 3,844 ms. The positions take 8 bytes of GPU memory for each point instead of 16. The change is not opt-in, and the pixels stay the same.The copies of one point inside regl-scatter2d, in 3.4.0 and on the pinned branch.
calcand regl-scatter2d copy each point four times and upload 16 bytes for each point. EachrestyleormoveTracesrepeats the copies and the upload.mainagainst this branch: 20 million points in ten traces,hovermode: false, strict bundles, Apple M3 Max, headless Chromium. The chart names commit a019f22 (source identical to 2441332).Now
calcpasses the arrays to regl-scatter2d, which uploads 8 bytes for each point one time. A recolor or a reorder uploads no positions.AnnZarro draws millions of single cells with plotly.js and needs this. Overview: #11.
Changes
src/traces/scattergl/calc.js: pass{x, y, count, rev}, cache the extremes, buildidsandtreeon demandpackage.json: pin regl-scatter2d to a fork commit with settylab/regl-scatter2d#1test/jasmine/tests/scattergl_test.js: 11 new specs, 1 updated specTesting
scattergl: 59 specs pass, andmainhas 48scattergl_select,gl2d_plot_interact,scatterpolarglandsplompassmainNotes
layout.datarevision. A new view of the same buffer range is not new data.main, a trace of 100,000 points or more gets a hover tree at every calc. Without hover, this branch builds the tree at the first read.plotly.min.jsgrows by 5,794 bytesI can split, reshape or drop any part. Thank you for your time.
Checklist
ready-for-prlabel, and it has no assignee or lists me as an assigneemainin my forkdist/package-lock.jsononly for a dependency changedraftlogs/as draftlogs/README.md describes, or I will add one after the pull request opens