Comparing yourself to others is not very useful. Studies have shown little to no improvement and in some cases even a negative effect on results when people are being compared to peers or another person. Also, always comparing yourself to others create dissatisfaction and leads to low self esteem from misjudging the other person or by under-evaluating yourself.
On the other hand when comparing yourself to you and your past results things change dramatically. Studies show that students who know that their results will be compared to their past results, and not to other peers, perform a lot better and constantly improve. Also, while these people struggle as well, fail or need to retake the same exams, tests or redo tasks several times before improving, once they do, their results skyrocket.
Comparing is not the issue, but rather the point of reference. When moving from comparing yourself to others or external references to yourself and past performances the effects are outstanding.