is it really time to let it go??

How do you keep going in a relationship when you get the sudden realization that the person may never change.. how do you continue to go on knowing you've invested so much time and energy. How do you watch that go to waste ???? 
Is it time to let go or rebuild ? 
Confused 🤷‍♀️ 
Please give kind useful advice.