I created a tooltip that appears on hover using Angular Material CDK Overlay, but my performance was affected badly and it made my app really slow. After some research I realized that I need to clear the overlayRef each time when closing the tooltip by using either dispose or detach.
Now, I'm trying to understand the difference between the two functions. According to angular material documentation they are defined as follows:
dispose - Cleans up the overlay from the DOM.
detach - Detaches an overlay from a portal.
When I tried using each of them I saw the same result so not sure which one I should use when.

