util
util copied to clipboard
chore: benchmarks for path2String & path2Absolute
在 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 字符串进行转换。
这两个方法的性能提升,是在那个 pr 做的?