Skip to content

Conversation

@SigureMo
Copy link
Member

@SigureMo SigureMo commented Aug 9, 2025

动机

利用 copilot 优化 biliass 性能

解决方案

交给 @copilot

类型

  • ✨ feat: 添加新功能
  • 🐛 fix: 修复 bug
  • 📝 docs: 对文档进行修改
  • ♻️ refactor: 代码重构(既不是新增功能,也不是修改 bug 的代码变动)
  • ⚡ perf: 提高性能的代码修改
  • 🧑‍💻 dx: 优化开发体验
  • 🔨 workflow: 工作流变动
  • 🏷️ types: 类型声明修改
  • 🚧 wip: 工作正在进行中
  • ✅ test: 测试用例添加及修改
  • 🔨 build: 影响构建系统或外部依赖关系的更改
  • 👷 ci: 更改 CI 配置文件和脚本
  • ❓ chore: 其它不涉及源码以及测试的修改
  • ⬆️ deps: 依赖项修改
  • 🔖 release: 发布新版本

Copilot AI review requested due to automatic review settings August 9, 2025 16:41
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR optimizes the biliass performance by replacing the cached crate with a custom cache implementation and applying various micro-optimizations throughout the codebase.

  • Implements a custom ZoomFactorCache using FxHashMap and OnceLock to replace the cached proc macro
  • Optimizes string handling in XML parsing by using direct string concatenation instead of collecting vectors
  • Applies performance optimizations including inlining, parallel filtering, and unstable sorting

Reviewed Changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/biliass/rust/src/writer/utils.rs Replaces cached proc macro with custom zoom factor cache implementation
packages/biliass/rust/src/reader/xml.rs Optimizes string concatenation in comment content parsing
packages/biliass/rust/src/reader/utils.rs Adds inline attribute to unescape_newline function
packages/biliass/rust/src/filter.rs Optimizes position matching with direct pattern matching and inline attribute
packages/biliass/rust/src/convert.rs Multiple optimizations including parallel filtering, unstable sorting, and string handling
packages/biliass/rust/Cargo.toml Updates dependencies and compiler optimization settings

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 9, 2025

CodSpeed Performance Report

Merging #547 will improve performances by 24.91%

Comparing biliass/optimize-perf (d269533) with main (842b6d1)

Summary

⚡ 23 improvements
✅ 7 untouched benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
test_protobuf_corpus[1176840] 620.4 ms 507 ms +22.37%
test_protobuf_corpus[1600157973] 37 ms 31.2 ms +18.59%
test_protobuf_corpus[1617171254] 38.1 ms 33.5 ms +13.59%
test_protobuf_corpus[1660054944] 25.6 ms 22.9 ms +12.11%
test_protobuf_corpus[2170097] 17.3 ms 15.5 ms +11.71%
test_protobuf_corpus[2428566] 417 ms 349 ms +19.47%
test_protobuf_corpus[285968687] 44.8 ms 39.4 ms +13.69%
test_protobuf_corpus[371495955] 142.1 ms 122.2 ms +16.24%
test_protobuf_corpus[527533] 502.7 ms 414.2 ms +21.36%
test_protobuf_corpus[527534] 329.9 ms 266.5 ms +23.79%
test_protobuf_corpus[527535] 393.1 ms 332 ms +18.4%
test_protobuf_corpus[527536] 656.3 ms 564.4 ms +16.27%
test_protobuf_corpus[745913430] 1.9 s 1.6 s +23.17%
test_xml_corpus[1176840] 121.2 ms 103 ms +17.69%
test_xml_corpus[1600157973] 12.3 ms 11.2 ms +10.08%
test_xml_corpus[1617171254] 23.4 ms 21 ms +11.59%
test_xml_corpus[1660054944] 24.6 ms 22.2 ms +10.87%
test_xml_corpus[285968687] 39.6 ms 35.1 ms +12.69%
test_xml_corpus[371495955] 321.9 ms 257.7 ms +24.91%
test_xml_corpus[527533] 28.1 ms 25.2 ms +11.57%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@SigureMo SigureMo merged commit 056b65a into main Aug 9, 2025
39 checks passed
@SigureMo SigureMo deleted the biliass/optimize-perf branch August 9, 2025 16: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