\, and \mathrm{\,} do not insert the same amount of space.
Expected outcome
\, and \mathrm{\,} should insert the same amount of space. This is what LaTeX does (as far as I can tell by eye).
Additional information
The difference is too minute to matter. As the MWE shows, the text has to be blown up to huge sizes to manifest it. At normal sizes, it is inconsequential. (Case in point: test_mathtext.py::test_operator_space, which compares \sin^2 \cos with \mathrm{sin}^2 \mathrm{\,cos}, thereby indirectly comparing \, and \mathrm{\,}.)
It can have unexpected side-effects, though; see #22852 (comment).
The culprit is the _make_space function. For \,, it returns 1/6 of the advance of an italicised 'm'. For \mathrm{\,}, it returns 1/6 of the advance of a regular 'm'.
Activity
anntzer commented on Jul 22, 2022
Actually that's not really what 1em is (https://tex.stackexchange.com/questions/98127/where-do-the-values-of-1em-and-1ex-come-from), but using that definition basically breaks all baseline images, whereas your proposed change seems the practical way out for now (using 'rm' instead of 'it' also breaks all baseline images). So this seems OK for me.