Should I notify competing researchers that I am working on the same problem? Say I am working on some specific research question, and during the course of my research I discover that some other group of researchers are working on the exact same problem (in my case I learned this because the authors of a paper had my research problem listed in their future work section). My questions are:


Should I notify the other researchers that I am working on the same problem? It seems unethical to let them continue on their way without knowing that they may be wasting their time and money.
If I do notify them, is best practice generally to start collaborating on the problem, or should we continue separately knowing that we're "racing" towards a result? Theoretically the goal of academic research is to expand the realm of human knowledge, so it seems counter-productive to knowingly avoid sharing information that would probably lead to a deeper result (and more quickly).


Full disclosure: I found myself in this position last year and did not notify the other researchers. Luckily, I suppose, I ended up publishing my results first. I have heard some horror stories from other researchers about months of research being wasted because of this exact scenario, so I am curious as to what I should do in the future should this happen again.
Norms on this probably vary between fields (not to mention between individuals in a given field). In my corner of theoretical physics it's not uncommon for people who know that another group is working on a similar problem to check in with each other on the status of the project and, if they are at similar stages, to coordinate posting papers on arXiv simultaneously so that no one scoops the other. This also has the advantage of helping to publicize the result--if someone skimming new articles notices that two or even three groups have put out papers on the same topic at the same time, it can attract more attention than the papers may have if they were spread out.

It has also been my experience that even when two groups are doing roughly the same thing at the same time, and even when the results have some overlap, they typically end up with different perspectives and some amount of complementarity. Sometimes the results even have no direct overlap but, taken together, build a stronger case. So I would generally not stop working on something just because someone else is, even if I know or suspect that they're farther along.