# 重新分类主题并重命名时 CPU 占用率极高

**URL:** https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897
**Category:** Bug
**Created:** [2019年四月24日 20:47 UTC](https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897 "2019-04-24T20:47:03Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2019年四月24日 20:47 UTC](https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897/1 "2019-04-24T20:47:03Z")

</div>

On [this topic](https://meta.discourse.org/t/improvements-bug-fix/115882) I was changing the category to Support and fixing the title, but I noticed that after selecting the category, every character I typed in the topic title bar would make the browser spike to 100% CPU. Memory usage also spikes for a while.

It does _not_ do this when not changing the category.

If I mash a whole bunch of keys at once it takes several seconds to catch up.

Reproduced using both Chrome and Firefox

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2019年四月25日 00:34 UTC](https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897/2 "2019-04-25T00:34:14Z")

</div>

Something for @j.jaffeux to investigate?

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2019年五月10日 15:05 UTC](https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897/4 "2019-05-10T15:05:39Z")

</div>

I have tracked it down to a too broad usage of `didReceiveAttrs`, this should vastly improve it:

[https://github.com/discourse/discourse/pull/7525](https://github.com/discourse/discourse/pull/7525)

[https://github.com/discourse/discourse/pull/7528](https://github.com/discourse/discourse/pull/7528)

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2019年五月13日 16:00 UTC](https://meta.discourse.org/t/huge-cpu-usage-when-recategorizing-a-topic-and-retitling-it/115897/5 "2019-05-13T16:00:12Z")

</div>

This topic was automatically closed after 3 days. New replies are no longer allowed.
