Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression bug fix of scatter2d traces not to change other traces colors #3315

Closed
wants to merge 3 commits into from

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 10, 2018

Fixes #3232 and https://github.com/plotly/phoenix-integration/issues/232 by disabling unstable palette color algorithm in regl-scatter2d.
Although some improvements are made in another branch and PR; that still requires more rewrites and possibly passing two palettes to the shaders.
While this could be a very annoying bug for Plotly users, this PR disabled the buggy palette mechanism in the module so that it may be fixed in the next minor version.
Also few other minor improvements are made in the regl-scatter2d module.
@etpinard
@alexcjohnson

package.json Outdated
@@ -103,7 +103,7 @@
"regl": "^1.3.7",
"regl-error2d": "^2.0.5",
"regl-line2d": "^3.0.12",
"regl-scatter2d": "^3.0.6",
"regl-scatter2d": "git://github.com/gl-vis/regl-scatter2d.git#22c218464af8a50a0fbbd8e6a983edb24f21fdab",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etpinard
Copy link
Contributor

Have you ran any benchmarks comparing with-palette and w/o palette performance?

I'd be ok (not sure I'm @dy would be though) merging this thing if performance slows down by "a little", but I'd like know by how much.

@archmoj
Copy link
Contributor Author

archmoj commented Dec 11, 2018

old: 4730.064ms
new: 4733.689ms
code:

var i, RGBA = [], X = [], Y = [];
for (i = 0; i < 1234567; ++i) {
X[i] = Math.random();
Y[i] = Math.random();
RGBA[i] = [Math.random(), Math.random(), Math.random(), Math.random()];
}
traceType = "scattergl";
console.time(traceType)
Plotly.newPlot(gd, {
data: [{
"type": traceType, "x": X, "y": Y,
"mode": "markers", "marker": {"size": 1.5, "color": RGBA}
}],
layout: {width: 1200, height: 800}
});
console.timeEnd(traceType);

@archmoj
Copy link
Contributor Author

archmoj commented Dec 11, 2018

And using a code that only generates red values (i.e. 0 - 255 range) I've got:
old: 3668.412ms
new: 3689.617ms
code:

var i, RGBA = [], X = [], Y = [];
for (i = 0; i < 1234567; ++i) {
X[i] = Math.random();
Y[i] = Math.random();
RGBA[i] = [Math.random(), 0, 0, 1];
}
traceType = "scattergl";
console.time(traceType)
Plotly.newPlot(gd, {
data: [{
"type": traceType, "x": X, "y": Y,
"mode": "markers", "marker": {"size": 5, "color": RGBA}
}],
layout: {width: 1200, height: 800}
});
console.timeEnd(traceType);

@archmoj
Copy link
Contributor Author

archmoj commented Dec 11, 2018

Codepen demo 1 & demo 2 using this branch.

@dy
Copy link
Contributor

dy commented Dec 11, 2018

The benefit here is not performance, but memory optimization - for <= 256 colors we require a single uint8 per-color, and for buffer that is uint32. We had that issue long ago with gl-scatter2d, when faced memory limitation.

@etpinard
Copy link
Contributor

etpinard commented Dec 11, 2018

Thanks for note @dy !

@archmoj could you take a screenshot of the task manager (open it with shift+escape)

image

on master and on your branch to compare memory consumption?

@archmoj
Copy link
Contributor Author

archmoj commented Dec 11, 2018

screenshot from 2018-12-11 17-21-56

screenshot from 2018-12-11 17-20-44

@archmoj
Copy link
Contributor Author

archmoj commented Dec 12, 2018

Closed in regard with #3328. But I prefer not to delete the branch for further improvements.

@archmoj archmoj closed this Dec 12, 2018
@etpinard etpinard deleted the issue-3232_min branch December 17, 2018 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something broken regression this used to work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scattergl traces with multiple colors set sometimes incorrectly format points in other scattergl traces
3 participants