I had a 335i and now have an E92 M3.
335i was nice and had some punch but the power delivery was very boring. Big punch off the line which was great for DD but then fell flat on its face at higher RPM. The M3 pulls until redline at 8400, making very nice noises getting there.
I was planning to keep the 335i for a long time and mod it, but I had a lot of issues with fuel pumps, injectors, etc, and sold it as soon as the warranty was up.
The M3 is in a different league, it's an entire package very well balanced for performance. The 335 was a mild car tweaked to provide above average sporty feeling.
Sure some will say that you can tune the hell out of the 335i to get close to the m3 in terms of performance, but its still going to be a 335i and you will spend a lot of cash in the process and maybe even lose your warranty. It's also going to be a challenge to keep a balanced setup.
If I had to do it again I would go straight to M3 without a doubt.
2015 M3 6MT | Yas Marina Blue, CF Roof, Cloth | Adaptive M Susp, 437M 19" Silver | Stripper
2013 X5 xDrive50i | Carbon Black | M Sport + M Perf, 333M | Loaded