I have an M2 Macbook air (IE; fanless little thing) but it completely desicrates the memory of its predecessor (Precision 5520 w/ Xeon E3-1505m v6) which has a 45W TDP.. (IE. double and a bit).
In single core it continues to readily beat my Theadripper 3970x workstation which has a 280W TDP... (more than 12x the TDP of the M2, though it definitely beats it in multi-core...)
I think something else is at play here. Be it a terrible filesystem or (as mentioned in another comment: the use of efficiency cores for compilation).