Algorithm used for Morphological Operations

Hello everyone, recently I have taken to benchmarking some OpenCV operations and found some interesting results; morphological operations(erosion and dilation) implemented in OpenCV were faster than correlation operation of OpenCV ( filter2d) . These results made me curious as morphological operations generally follow an algorithm similar to correlation, could someone please tell me which algorithm is being used for morphological operations. Thank You