Skip to content

改进块引锚文本实现方式以提升稳定性和性能 #3561

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

Closed
88250 opened this issue Dec 3, 2021 · 0 comments
Closed

改进块引锚文本实现方式以提升稳定性和性能 #3561

88250 opened this issue Dec 3, 2021 · 0 comments
Assignees
Milestone

Comments

@88250
Copy link
Member

88250 commented Dec 3, 2021

之前的动态锚文本 ((id)) 实现在稳定性和性能上有瓶颈:

  • 导致冷启动解析时间过长,因为需要全库扫描
  • 内存占用较高,特别是在移动端设备上可能引起崩溃
  • 数据保存时需要同步修改引用处,一个块引用过多时会比较卡

目前测试下来,在文档数量上万、总块数到达几十万(平均一个文档几十个块)以后这些问题会非常明显。经过一段时间的改进尝试,已经找不到更有效的优化方案了。

动态锚文本在一些场景下还是比较有用的,无法砍掉这个特性,但有个折中的方案是将其“静态化”:

  • 解析器提供新的语法 ((id 'text')),使用单引号表示动态锚文本静态化以后的结果,之前的双引号仍旧表示用户设置的锚文本
  • 之前的动态锚文本自动迁移静态化,即 .sy 文件中只存在设置了锚文本的块引节点
  • 定义块发生变动时,在打开的笔记本上自动处理锚文本静态化,处理完后如果又打开一个笔记本,则可以通过文档树全局刷新进行最终一致性保证

节点语法结构总结:

  • ((id "用户设置的静态锚文本"))
  • ((id '动态锚文本静态化'))
@88250 88250 added this to the 1.5.5 milestone Dec 3, 2021
@88250 88250 self-assigned this Dec 3, 2021
88250 added a commit to 88250/lute that referenced this issue Dec 3, 2021

Unverified

This user has not yet uploaded their public signing key.
@88250 88250 closed this as completed Dec 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants