This could be easily explained by the fact that the M1 on battery run at full speed on Linux because Linux doesn't implement the proper power management. When the two are running on AC the difference is only around 15% for my use case (compiling C projects)
15% is still very huge. That is 1 or 2 generations of processors. That basically means by running Linux instead of OSX you have the performance of a to be M2+ chip.
You may find running the compilation workload in Linux in a VM on MacOS runs faster than on MacOS directly, while benefitting from the MacOS battery management.