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

Improve performance for unfolding headings #10935

Closed
TCOTC opened this issue Apr 8, 2024 · 32 comments
Closed

Improve performance for unfolding headings #10935

TCOTC opened this issue Apr 8, 2024 · 32 comments
Assignees
Milestone

Comments

@TCOTC
Copy link
Contributor

TCOTC commented Apr 8, 2024

In what scenarios do you need this feature?

现在每次展开标题都要加载一段时间,体验不够流畅

Describe the optimal solution

思路:

  • 在文档界面内出现折叠的标题时预加载标题下的内容,以便更快展开标题

    • 当折叠的标题离开文档界面时停止预加载
    • 当折叠的标题离开文档界面一段时间之后清除预加载缓存的内容
  • 在折叠标题后的一段时间内再展开标题不需要重新加载,像目前展开列表那样可以立即展开。提高短时间内连续折叠与展开标题的体验

Describe the candidate solution

No response

Other information

No response

@88250
Copy link
Member

88250 commented Apr 8, 2024

预加载有两个问题:

  1. 资源占用
  2. 无法保证数据一致

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

标题跟列表的折叠有哪些不同呢?

@88250
Copy link
Member

88250 commented Apr 8, 2024

主要就是是否是动态加载,折叠的话好像标题已加载的 DOM 会删掉。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

那折叠的时候就不需要立刻删掉 DOM ,只要在界面上不显示就行了

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

无法保证数据一致

什么会造成数据不一致呢?

@88250
Copy link
Member

88250 commented Apr 8, 2024 via email

@zxhd863943427
Copy link
Contributor

我感觉这个速度是不太合理的

图片

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

分屏和新窗口会该标题下方内容。

但分屏的时候标题展开和折叠应该是同步的,编辑也应该是同步的

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

不推荐。对我这种会打开很多页签、分屏的人,某种情况下资源占用是灾难

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

不推荐。对我这种会打开很多页签、分屏的人,某种情况下资源占用是灾难

这个方案不应该会占用很多资源

@88250
Copy link
Member

88250 commented Apr 8, 2024 via email

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

不推荐。对我这种会打开很多页签、分屏的人,某种情况下资源占用是灾难

这个方案不应该会占用很多资源

我正常三十几个页签,主窗口12个分屏

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

不推荐。对我这种会打开很多页签、分屏的人,某种情况下资源占用是灾难

这个方案不应该会占用很多资源

我正常三十几个页签,主窗口12个分屏

你总不能在几分钟内在三十几个页签内来回折叠和展开一堆标题,正常使用不应该有明显影响

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

@TCOTC 用测试空间,录个视频你大致感受一下😂 我对性能的提升渴求比你大

SiYuan_1yoYctuiUf.mp4

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

@UFDXD 这是什么鬼需求?

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

@TCOTC 这是我写的功能,我之后打算让D大实现(自己写的各种情况兼容性不好)

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

不过工作区 #10809 实现了,我就不需要了

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

预加载不好做就算了。再讨论一下第二点:

在折叠标题后的一段时间内再展开标题不需要重新加载,像目前展开列表那样可以立即展开。提高短时间内连续折叠与展开标题的体验

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

感觉真正实用,没人喜欢玩短时间连续玩折叠开关按钮。比如我,我搞了个这个
image
实际使用我自己都很少用

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

现在展开标题跟打开文档一样慢,感觉应该有优化的余地

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

还没到需要提升这种性能的地步,真的,不如推 多工作区 可以救命些

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

优化现有功能还是很重要的嘛,否则以后功能越来越多就更没精力维护了

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

真的,不如推 多工作区 可以救命些

不过这些大的 feature 一时半会也不会做

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

优化是有必要的,但是如果这个优化会引起更多的问题就没必要了,总之这种程度的优化,得实在没性能提升的时候再压着头皮做。也就是等思源完全体再搞。

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

这种程度的优化,得实在没性能提升的时候再压着头皮做。也就是等思源完全体再搞。

我个人是更重视现有功能的使用体验,毕竟很多 feature 都还遥遥无期(比如这堆我提的 issues),等不到「思源完全体」

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

@TCOTC 我可以打包票,这个#10809 实现起来比你这个优化还要简单 因为大的功能架构都在,只要组合拼图

@TCOTC
Copy link
Contributor Author

TCOTC commented Apr 8, 2024

@TCOTC 我可以打包票,这个#10809 实现起来比你这个优化还要简单 因为大的功能架构都在,只要组合拼图

我这个 #10671 也简单,但也还没排期,只能慢慢等了

@UFDXD
Copy link

UFDXD commented Apr 8, 2024

@TCOTC 这个我赞成

@TCOTC
Copy link
Contributor Author

TCOTC commented Jun 18, 2024

@88250 我考虑了一下,预加载的意义不大,容易造成卡顿;但第二点需求还是有价值的:

在折叠标题后的一段时间内再展开标题不需要重新加载,像目前展开列表那样可以立即展开。提高短时间内连续折叠与展开标题的体验

我觉得至少在 5 秒内不用从 DOM 中删除被折叠起来的块,只在外观上隐藏。这样对性能的影响也很小。

因为有时候折叠起来只是为了看看折叠后的效果,尤其是在排版的时候。

@TCOTC TCOTC changed the title 改进标题折叠与展开 折叠标题时延迟从 DOM 中删除子块 Jun 18, 2024
@88250
Copy link
Member

88250 commented Jun 23, 2024

不行的,之前已经解释过了,这样会造成数据不一致的。

@Vanessa219 Vanessa219 changed the title 折叠标题时延迟从 DOM 中删除子块 Improve performance for unfolding headings Jun 24, 2024
@Vanessa219 Vanessa219 self-assigned this Jun 24, 2024
@Vanessa219 Vanessa219 added this to the 3.1.0 milestone Jun 24, 2024
Vanessa219 added a commit that referenced this issue Jun 24, 2024
@mozhux
Copy link

mozhux commented Jun 24, 2024

这时候其他家专门的折叠块优势就出来了?自主可控。

@TCOTC
Copy link
Contributor Author

TCOTC commented Jun 24, 2024

我用 FlowUs 的时候觉得转换折叠标题很繁琐,用思源的时候又觉得不能记忆折叠状态很难用,不知道有没有更好的办法

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

6 participants