I think getting an idea of the market should be the first thing you do before building. And once you accomplish that first step then you can work on getting an MVP to the market as quickly as possible. The timeline for me is usually between one week and one month.