Get a proper fit. Worked wonders for me. Based on that, you can buy the bike with a geometry that allows you to achieve your fit. Or speak to one, decide which size frame to get and then go and do the fit with the new bike.
I would still test ride the bike though, I tested two and the second was immediately more comfortable. Perhaps with a fit the first could have gotten there but I don't know.