While working on a research paper with a coauthor, I found an unpublished paper in arXiv and discovered out that the technique we developed in our paper can be used to improve a result in the unpublished one. Specifically, we can design a superior algorithm to solve the same problem solved in the arXiv paper. If we publish our results, then the author of that arXiv paper will have a hard time publishing his paper, since some journals will not consider his algorithm once a better one is available. Of course, we cite the arXiv paper and there is no law against publishing improved results, but this may harm the author of the arXiv paper. Is there a way to publish the new result without creating enmity?
One potential option could be to combine the work and submit a joint paper. However, the papers do not "mix" very well since our paper is mainly about a different technique - the improved algorithm is only a usage example of it. Combining the papers will create a very large and inconsistent paper.
Another option is to wait until his paper is accepted for publication and only then publish our paper with the improved result. However, it seems unscientific to withhold results that we already know.