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

chore: benchmarks for path2String & path2Absolute #101

Merged
merged 1 commit into from
Aug 1, 2024
Merged

Conversation

xiaoiver
Copy link
Contributor

@xiaoiver xiaoiver commented Jan 12, 2023

在 Path 初始化时会调用这两个方法,用于将字符串例如 'M 100 100 l 200 200' 转换成包含绝对命令的 PathArray:

$ yarn benchmarks

相比 2.x @antv/path-util 也就是 G 4.0 中使用的方法,3.x 的要快 3 倍左右:

Path2String#4.0 x 14,253 ops/sec ±3.62% (80 runs sampled)
Path2String#5.0 x 50,066 ops/sec ±2.89% (84 runs sampled)
Fastest is Path2String#5.0

Path2Absolute#4.0 x 14,524 ops/sec ±2.55% (80 runs sampled)
Path2Absolute#5.0 x 35,120 ops/sec ±3.10% (81 runs sampled)
Fastest is Path2Absolute#5.0

测试使用了 benchmarks.js,使用新旧版本对同样的 Path 字符串进行转换。

@hustcc
Copy link
Member

hustcc commented Jan 28, 2023

这两个方法的性能提升,是在那个 pr 做的?

@hustcc hustcc merged commit 43574e8 into master Aug 1, 2024
@hustcc hustcc deleted the fix-path-string branch August 1, 2024 11:52
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