# 이미지가 많은 주제에서 Chrome 업로드가 느립니다

**URL:** https://meta.discourse.org/t/chrome-slow-to-upload-in-topic-with-many-images/325890
**Category:** Bug
**Tags:** uploads
**Created:** [9월 10, 2024, 5:54오후 UTC](https://meta.discourse.org/t/chrome-slow-to-upload-in-topic-with-many-images/325890 "2024-09-10T17:54:33Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [9월 12, 2024, 2:01오후 UTC](https://meta.discourse.org/t/chrome-slow-to-upload-in-topic-with-many-images/325890/8 "2024-09-12T14:01:50Z")

</div>

성능 저하는 이 커밋에서 도입되었습니다: [FIX: when replacing text in composer maintain history (#28537) · discourse/discourse@e25578d · GitHub](https://github.com/discourse/discourse/commit/e25578d702791bac80b431acd450cc53b6c39a3c). 따라서 @piffy 님이 OP에서 언급한 '약 2주’와 일치합니다.

문제는 `execCommand("insertText", text)`가 기본적으로 `text`를 수동으로 타이핑하는 것과 동일하다는 점입니다. Chrome(그리고 아마도 Firefox도)은 각 '가상 키 입력’마다 리플로우를 수행하는 것 같습니다 😢

실제로 대체해야 하는 텍스트만 '타이핑’하도록 하면 성능을 크게 개선할 수 있습니다:

> <https://github.com/discourse/discourse/pull/28880>
>
> Followup to e25578d702791bac80b431acd450cc53b6c39a3c
> 
> Using execCommand to rep…lace the entire contents of the textarea is very slow for larger posts (it seems the browser does a reflow after every 'virtual keypress'.
> 
> This commit updates the \`replaceText\` function to be more surgical with its \`insertAt\` calls. Now it only selects & replaces the characters which are actually being replaced.

---

_[View the full topic](https://meta.discourse.org/t/chrome-slow-to-upload-in-topic-with-many-images/325890)._
