Short answer: It's always better to inform them before you commence, rather than afterwards.
Think about the processes involved in onboarding:
- Set up user accounts and access
- Building/safety induction
- Walk through/induction of code
- Introduction to staff
These all cost the organisation time and money. More than anything, they take people away from their normal duties to make sure you are properly set up and ready to start. By turning up and then quitting, you have wasted lots of people's time.
One other very good reason is that if there was another strong candidate, if you notify them as soon as possible of your intention to break the contract, they have half a chance of getting their next best person in to fill the role without having to go through the whole expense and time of advertising, shortlist, interviewing and selecting.
If you've decided to not proceed, you need to let them know now.