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

perf: optimize performance #1779

Open
wants to merge 15 commits into
base: next
Choose a base branch
from
Open

perf: optimize performance #1779

wants to merge 15 commits into from

Conversation

Aarebecca
Copy link
Contributor

@Aarebecca Aarebecca commented Sep 24, 2024

  • 设置 glMatrix Array Type 为 Array

实测 10W Group+ 10W Rect 下,绘制时长稳定提升约 2.7% (1120ms -> 1090ms)

  • 优化 vec3.equals 性能

性能提升约 5%

image
  • Transform 支持传入数组类型

实测 10W Group+ 10W Rect 下,绘制时长稳定提升约 12% (1070ms -> 940ms)

  • 支持批量插入节点

使用方式:

import { DocumentFragment, Group, Circle } from '@antv/g';

const group = new Group();
const fragment = new DocumentFragment();

for (let i = 0; i < 10_000; i++) {
  const circle = new Circle({ style: { cx: 10, cy: 10, r: 10 } });
  fragment.appendChild(circle);
}

// 批量插入
group.appendChild(fragment);

实测 3层 Group, 10W Group+ 10W Rect 下,绘制时长稳定提升约 12% (1180ms -> 1030ms)

  • 推迟首屏事件触发及 RTree 同步

优化首屏 triggerPendingEvents ,首屏下一帧进行全量同步,并跳过首屏帧内的事件更新

实测 3层 Group, 10W Group+ 10W Rect 下,绘制时长稳定提升约 18% (1050ms -> 860ms)

关闭性能工具的情况下,绘制时长甚至可以控制在 600ms

  • 优化循环调用
  • 提供 Canvas 抗锯齿开关

Base automatically changed from release to next September 27, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants