Skip to content

Optimize textInsert/setText

Waqar Ahmed requested to merge work/optimize-text-insert into master

TLDR; accessibility stuff is super slow, try do it less.

When inserting text our document emits two signals, a public one and an internal one. Accessibility listens to the internal signal i.e., textInsertedRange and then notifies any listening screen readers that new text is available.

The way our code was working lead to about 3-4 textInsertedRange per line which slowed things down to a crawl. I imagine it would also be a horrible experience for a screen reader which doesn't need to know about how the text editor is behaving internally.

With this change, all these signal emissions are removed and we emit one fat signal that reports what text was inserted.

For me this brings down timings from 10 seconds to about 1.5 seconds.

BUG: 478250

Merge request reports