If the performance is approx the same then look at:
Status
Price diff
Resale value
Emotions/looks
Im probably going to buy the M not because of speed, but the complete package. The 335i doesnt have half the things the M has. the M sets the benchmark, and been doing so for almost 3 decades.
90% of people buy cars tht suit their needs, 10% just want the damn car. people who buy M's fall in the 10% bracket.