tweb icon indicating copy to clipboard operation
tweb copied to clipboard

[BUG] The lack of keeping a static function reference in Event Listeners

Open randmaru opened this issue 6 months ago • 0 comments

Describe the bug Due to the use of anonymous functions in event listeners, there is an endless filling of the heap, which can indirectly affect the performance described in this Issue.

  1. Go to this channel
  2. Open the Chrome DevTools
  3. In the DevTools, open the Performance monitor tab
  4. Start scrolling using the PageDown/PageUp key
  5. You will see an endless increase in the heap size and the number of event listeners. As well as the periodic triggering of an exception in IntersectionObserver

Expected behavior You need to use named(static) functions to fix this problem. And find out more about its solution in MDN

Screenshots Check JS heap size & quantity Event Listeners

Desktop and Smartphone:

  • Device: All devises
  • OS: All OS where Chromium uses V8
  • Browser: All Chromium based browsers
  • Version: Latest stable version

Additional context I conducted this research as part of a competition, but I can't say for sure if my hypothesis is correct. It takes a lot of time to check it, and I don't have it. As you understand, it is necessary to perform a large amount of work and conduct a thorough check.

randmaru avatar Jul 28 '24 23:07 randmaru