scrollToIndex runs multiple times on resize
Description
After profiling an application that uses iron-list extensively I discovered that a great deal of cpu time is consumed by the scrollToIndex function that get called by the resizeHandler. It appears that the function is called many more times than necessary, seriously affecting performance. Adding a debounce wrapper around the scrollToIndex call inside the resizeHandler improves performance significantly without affecting the functionality of the list.
Expected outcome
The lists should be snappy and the scrollToIndex function should not be called more than once every ~16ms.
Actual outcome
There is a considerable delay in rendering the lists.
@d-mo resizeHandler already has debounce wrapper. https://github.com/PolymerElements/iron-list/blob/master/iron-list.html#L1426, but it waits for just 1ms. It could be changed to 16ms but that could also be bad UX when the list is in a page inside <iron-pages>. In your case, is the resizeHandler called multiple times because you resized the browser's window or are multiple elements firing the iron-resize event?