Adding N annotations takes O(N^2) time
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
调研方向
首先运行 issue 中的复现脚本,并对重复调用 fig.add_annotation 进行性能分析。跟踪 Python Figure 的注释路径,以确定累积成本增长的位置,然后使用同一个脚本验证添加大量注释不再表现出二次行为。
由索引模型根据 Issue 内容生成。
描述
Plotly is unreasonably slow to add more than a few hundred annotations to a plot. This code
import time
import plotly
fig = plotly.graph_objects.Figure()
NUM_ANNOTATIONS=1000
start_time = time.monotonic()
for i in range(NUM_ANNOTATIONS):
fig.add_annotation(
x=i,
y=time.monotonic() - start_time,
text=str(i),
)
print(i)
fig.update_layout(
xaxis_range=[0,NUM_ANNOTATIONS],
yaxis_range=[0,time.monotonic() - start_time],
xaxis_title_text="# Annotations",
yaxis_title_text="Cumulative Time [s]",
)
fig.show()
produces this plot
- 主要语言
- Python
- 星标
- 18.8k
- 派生
- 2.8k
- 平均合并
- 13 小时 41 分钟
- 30 天内合并 PR
- 21
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
plotly/plotly.py 的其他 Issue
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 65/100
-
P3 size: 1 task
难度 2/5 1-3 小时 新手友好度 72/100
-
bug P1
难度 1/5 1 小时以内 新手友好度 68/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 62/100
-
feature P3
难度 2/5 1-3 小时 新手友好度 72/100
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
learningequality/ricecooker#747 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
难度 2/5 1-3 小时 新手友好度 76/100
run-llama/llama_index#23199 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
KhronosGroup/glTF-Blender-IO#2769 ·