I have driven both.
m340xi is definitely more nimble (smaller, lower center of gravity and smaller wheel base; makes sense right?) but x3m40i was definitely nimble enough and had enough power and shifted very nicely.
I came from driving f83 m4 to x3m40i and as daily driving I enjoy x3m40i better.