[BUG]: `scattergl` hover is slow above 100k points

オープン
#8,134 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript

調査の方向性

Start by comparing the hover path in src/traces/scattergl/hover.js with the threshold and point-cluster tree behavior in src/traces/scattergl/constants.ts; reproduce the lag with the provided 100,000 point example and compare it with 99,999 points. Determine why the .range() call is slow with infinite or wide bounds, then verify hover remains responsive at and above the threshold.

索引モデルが issue の本文から書いたものです。

説明

bug P3 size: 3
Description

With 100,000 or more points, hovering over a scattergl trace is much slower than with 99,999 points.

Steps to reproduce
  • Open Plotly devtools and paste the following into the browser devtools console:
let n = 100000;

Plotly.newPlot('graph', [{
  type: 'scattergl',
  mode: 'markers',
  x0: 0,
  dx: 1,
  y: Array(n).fill(0)
}]);
  • Hover over individual points and note the lag
  • Change n to 99999 and note that hover is fast
Notes
  • At TOO_MANY_POINTS (src/traces/scattergl/constants.ts), scattergl switches from a plain array to the point-cluster tree
  • The slow call is .range() in src/traces/scattergl/hover.js
  • It's very slow with infinite bounds; it also seems slower than a plain array scan when the bounds cover a large share of the points
  • Either hover.js calls .range() in a non-optimal way, or plotly/point-cluster has a performance bug
  • #8052 stops the plot from freezing, but hover is still laggy
  • Also related to #8036
主要言語
JavaScript
スター
18.4k
フォーク
2.1k
平均マージ
1日 5時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

plotly/plotly.js のほかの issue

plotly/plotly.js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。