SERVER-137381ClosedFixed

Remove dynamic_cast to $match from graph code

The benchmark added in SERVER-136156 revealed that the majority of the time is spent in the dynamic_cast. We should amortise the type check like we do for DocumentSourceSingleDocumentTransformation and turn it into a typeid check since $match has no subclasses.

Affected Versions
Versions known to exhibit this issue

No affected versions recorded.

Fixed Versions
Versions that include the fix
9.1.0-rc09.1.0-rc1025
Components
Server components related to this issue

No components specified.

Labels
Tags and classification

No labels assigned.