You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
High CPU usage and lag during cursor positioning #1648
The Stack Trance above is at code line number enabled?
Yes, that's right. There are to much Recalculate Style and tons of forced Layout operations. BTW setCursor is also a performance bottleneck because it consume twice as much time as the whole document rendering.
@Jocs I think I found another issue: we render a document twice when loading the first file using editor event bus and muya force render the whole document. This issue doesn't occur when closing the tab and open the file again in the same instance.
it consume twice
What do you mean twice here?
render takes ~180ms and setCursor ~420ms (Chromiums Recalculate Style take ~50s and Layout the remaining).
Thank you for this detailed performance report. The editor engine has been completely rewritten since this was filed. In the new engine (@muyajs/core, now shipping): clicking between paragraphs no longer triggers a content re-render — the click handler defers via requestAnimationFrame and passes needUpdate=false to setCursor, so only the DOM Selection is updated. Code block line numbers are now reconciled O(delta) via ResizeObserver (which fires post-layout asynchronously), not on every cursor change. There is no longer a document-wide style recalculation on inter-paragraph cursor positioning. Closing as resolved by the engine migration.
Activity
fxha commentedon Nov 8, 2019
Numbered code block lines are temporary disabled due to this issue.
Stack Trance:
Jocs commentedon Nov 8, 2019
@fxha The Stack Trance above is at
code line numberenabled?fxha commentedon Nov 8, 2019
Yes, that's right. There are to much
Recalculate Styleand tons of forcedLayoutoperations. BTWsetCursoris also a performance bottleneck because it consume twice as much time as the whole document rendering.Jocs commentedon Nov 8, 2019
What do you mean twice here?
fxha commentedon Nov 8, 2019
@Jocs I think I found another issue: we render a document twice when loading the first file using editor event bus and muya force render the whole document. This issue doesn't occur when closing the tab and open the file again in the same instance.
rendertakes ~180ms andsetCursor~420ms (ChromiumsRecalculate Styletake ~50s andLayoutthe remaining).Temporary disable numbered code block lines due to #1648
Temporary disable numbered code block lines due to #1648 (#1658)
Jocs commentedon Nov 21, 2019
@fxha I move this issue to project 0.17.0, and will not release the line number feature in v0.16.0.
Temporary disable numbered code block lines due to marktext#1648 (mar…
Jocs commentedon Jun 27, 2026
Thank you for this detailed performance report. The editor engine has been completely rewritten since this was filed. In the new engine (@muyajs/core, now shipping): clicking between paragraphs no longer triggers a content re-render — the click handler defers via requestAnimationFrame and passes needUpdate=false to setCursor, so only the DOM Selection is updated. Code block line numbers are now reconciled O(delta) via ResizeObserver (which fires post-layout asynchronously), not on every cursor change. There is no longer a document-wide style recalculation on inter-paragraph cursor positioning. Closing as resolved by the engine migration.