Chrome slow to upload in topic with many images

The performance regression was introduced by this commit: FIX: when replacing text in composer maintain history (#28537) · discourse/discourse@e25578d · GitHub, so it lines up with the ‘about 2 weeks’ you mentioned in the OP @piffy.

The problem is that execCommand("insertText", text) is essentially equivalent to typing out text manually. Chrome (and, I guess, Firefox) seems to do a reflow on every ‘virtual keypress’ :cry:

We can improve things significantly by only ‘typing out’ the text we actually need to replace:

4 Likes