作者:bj_gqdy_342 | 来源:互联网 | 2023-10-13 06:44
For some reason a tab in Chrome 59 with a Flarum.org discussion that I don't interact with uses approx 4% CPU on my MBP Pro 2014. Not a lot but this shouldn't be necessary and this is probably quite a drain on mobile devices. With the Chrome Inspector Performance pane it was quite trivial to pinpoint this to:
flarum/utils/ScrollListener.loop()
Apparently that method is called on each animation frame and for some reason this is triggered even for completely idle pages. Alas I'm not exactly a JS expert so I don't have a clue as to why this is happening or what can be done about this.
该提问来源于开源项目:flarum/core
I observed the same on my Ubuntu system (after you pointed it out). With the fix, the CPU is slightly below 20%.