illustration (attribution, if any possible, is at the end of the article)
Perseverance is among the (six or ten) "Perfected Qualities." There shouldn't be a surprise once it is understood that 'good' intentions don't naïvely guaranty 'good' results, independently from the wider context (gplus.wallez.name/PHZNG4GzDrM): navigating though successive contexts, creatively engaging with each iteration, requires perseverance if one is to indeed influence the world into a wholesome direction.
This is easily understood, but somehow people forget about it as regularly as clockwork!
Imagine you're in a complex entanglement of unwholesome tendencies, and you take 20 years iterating through the various stages in order to improve the forthcoming unfolding of the situation.
If after 20 years patiently trying to adapt, to respond, to engage, to create, you achieve the progress you were aiming for, then people (including yourself) will easily laud your perseverance.
But, if after 20 years you conclude that you have no idea anymore on how to try differently, and that maybe you can still help indirectly but not so directly anymore, then people (including yourself) will easily comment on how you 'wasted' 20 years "for nothing".
The reality though is that you might be 'right' to persevere as long as you creatively engage, as long as you have insights into how to try and improve the situation, as long as you 'see' a possible wholesome change… and it also is right to accept that you're not God, that you cannot force an outcome onto the world by your sole will (independently from other inter-dependent wills), once you don't see any prospect of improvement.
Perseverance is not stubbornness, people easily understand this, but most people judge « perseverance vs. stubbornness » based on time and outcome, rather than based on intention and potential.
If your intention is wholesome and you see the potential for actualising it, you're into perseverance.
If your intention is unwholesome (e.g. clinging, trying to force an outcome without taking other perspectives than yours into consideration, etc.), or if you cannot actually 'see' how the potential wished for could be realised, you're into stubbornness.
This has nothing to do with the time spend so far (neither saying "it's too early to tell or to stop" nor saying "it's too long since the work started").
The Perfection of Perseverance requires the association of Perseverance and Wisdom. And Wisdom should certainly not deny the past, but it should base present decisions (decisions about the present) on the present situation, its present potentials and its present hindrances. A classical mistake when giving too much weight to the past is when one says "I tried this 'solution' before, there's no reason to try again" while missing that the situation has changed and that what prevented the 'solution' to yield the expected result the first time is no longer present (or is now 'moderated' by other factors having ceased or arisen).
« How to know when too much time and energy has been invested in a particular cause? » is not a helpful question.
It comes naturally to mind but it poses the question in erroneous terms, which can only lead to an 'answer' in erroneous terms.
If you want to use time, there is a way, but it isn't a "make it or die trying": you can set deadlines for 'reviews'.
For example, you might set out to do your utmost "for 2 years" to bring a wholesome momentum into the world. After 2 years, you 'review': you take the time to suspend the engagement, to take a step back and to see if there are lessons to be gained that you had not so much paid attention to [Be mindful that the lessons might be about the past, and that they could have been useful if picked up at the time but not anymore… i.e. the lessons themselves might be outdated.]. This is about setting a timer to reflect, a mindfulness bell (as Thích Nhất Hạnh would call it), a point in time to ensure you don't keep pushing out of habit rather than out of choice. As such, this is absolutely not equivalent to a prejudice making "2 years" the deadline to "either succeed or stop": it's about being aware of how things unfold and about looking at the situation afresh (without biases, notably based on prior 'investment'), it's about adaptation and responsiveness, not about caricaturing a complex unfolding process by a black&white fixed photography.