Skip to content

Speed up NativeEditContext _updateSelectionAndControlBounds for cases when a lot of editors are created #263525

@mjbvz

Description

@mjbvz

As part of #263499, I'm trying to speed up rendering of chat responses. When a response contains a large number of code blocks, we end up creating a large number of editors for it. One slow part of this is the NativeEditContext. _updateSelectionAndControlBounds call after the editor is created

Here you can see a few of these calls:

Image

This call is slow because it forces a recalculate styles + relayout

In my regular chat session log, we end up spending several hundred ms just on these calls when you first open the session log:

Image

Would it be possible to avoid this call until there is a hint the NativeContext is needed, such as the editor becoming focused?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions