rcbyr / keen-slider

The HTML touch slider carousel with the most native feeling you will get.

Home Page:https://keen-slider.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Destroy causes expensive forced Recalculate Layout event

fabianeichinger opened this issue · comments

I noticed in a project using this library, that calling destroy() on a KeenSlider instance very often forces a task-blocking Recalculate Layout event, causing jank with complicated layouts. When destroying more than one slider in the same microtask, this can happen for each one multiplying the performance hit.

Profiling points to applyAttributes(remove) calling dir(element) in a ternary operator as the cause. The result of dir doesn't matter in this case as remove is true when destroying, so it seems avoidable by flipping the &&.