Thanks to visit codestin.com
Credit goes to github.com

Skip to content

perf: optimize wait times#79

Merged
timerring merged 1 commit intomainfrom
dev
Jan 8, 2026
Merged

perf: optimize wait times#79
timerring merged 1 commit intomainfrom
dev

Conversation

@timerring
Copy link
Member

Summary / 概述

Optimize Bilibili Read sync performance by replacing fixed wait times with smart polling, reducing total sync time from ~8.5s to ~1-2.5s.

Related Issue / 关联 Issue

Closes #78

Type of Change / 更改类型

  • Bug fix / 修复 Bug
  • New feature / 新功能
  • Breaking change / 破坏性更改
  • Documentation update / 文档更新
  • Performance improvement / 性能优化
  • Code refactoring / 代码重构
  • Other / 其他

Changes Made / 更改内容

  • Replaced fixed 4000ms page load wait with editor.isReady polling
  • Removed unnecessary 500ms wait after title fill
  • Removed 2000ms wait after content injection
  • Reduced post-save wait from 2000ms to 500ms
  • Merged title and content fill into single executeScript call

Implementation Details / 实现细节

Key Changes / 主要更改:

Before After
Fixed 4000ms page load Poll editor.isReady (~1-2s)
Fixed 500ms after title Removed
Fixed 2000ms after content Removed
Fixed 2000ms after save 500ms
Total ~8.5s Total ~1-2.5s

Technical Notes / 技术说明:

  • UEditor exposes isReady property to check initialization status
  • execCommand('inserthtml') is synchronous, no wait needed after execution
  • Polling interval set to 100ms with 10s timeout for reliability

Testing / 测试

Testing Checklist / 测试清单

  • I have tested this code locally
  • All existing tests pass
  • I have added tests for new functionality
  • I have tested on the affected platform(s)
  • I have verified the changes work in the target browser(s)

Manual Testing Steps / 手动测试步骤

  1. Load extension in Chrome
  2. Open md.doocs.org and create an article
  3. Sync to B站专栏
  4. Observe sync completes in ~2 seconds instead of ~8 seconds

Screenshots/Videos / 截图/视频

N/A

Additional Notes / 补充说明

This optimization specifically targets Bilibili Read. Similar optimizations could be applied to other platforms that use fixed wait times.

@timerring timerring self-assigned this Jan 8, 2026
@timerring timerring added the enhancement New feature or request label Jan 8, 2026
Copy link
Member Author

@timerring timerring left a comment

Choose a reason for hiding this comment

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

LG

@timerring timerring merged commit 89ad469 into main Jan 8, 2026
@timerring timerring deleted the dev branch January 8, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Bilibili Read sync is slow due to excessive fixed wait times

1 participant