Visibility observer causing performance issues
See original GitHub issueI’m submitting a … (check one with “x”)
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here
Current behavior When using ngx-charts, I noticed in my profiling tab that something was running every 50ms. I tracked it down to the VisibilityObserver.
This is what it looks like.
I’m not exactly sure what the observer does, but my dashboard is showing 6 charts and it looks like the UI becomes kinda unresponsive because of this.
Expected behavior /
Reproduction of the problem /
What is the motivation / use case for changing the behavior? Performance issue
Please tell us about your environment: macOS, VS Code, Angular-CLI
-
ngx-charts version: 6.0.2
-
Angular version: 4.x
-
Browser: all
-
Language: TypeScript
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
JavaScript Intersection Observer: Everything You Need to Know
Use the Intersection Observer API to implement lazy loading, infinite scrolling, and more, without using complicated logic or causing performance issues.
Read more >Timing element visibility with the Intersection Observer API
In this article, we'll build a mock blog which has a number of ads interspersed among the contents of the page, then use...
Read more >Intersection Observer API for Element Visibility ... - Medium
The significant performance overhead this causes through continuous polling leads to image loading, page loading, and scrolling delay. Lazy ...
Read more >IntersectionObserver API Performance: Many vs. Shared In ...
At this point, it may become clear that sharing IntersectionObserver instances has better performance. But, if we dig a bit deeper, it becomes...
Read more >Intersection Observer fails sometimes when i scroll fast
Intersection Observer runs an asynchronous function in a loop which checks the position of observed DOM elements.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is how I fixed it. It feels really hacky though and somehow I think it should be solved in this library. This made sure those values are not
0
and prevents the VisibilityObserver to trigger an infinite loop.Please add this to documentation so anyone face issue set width height