From a Daf Yomi of Talmud:
http://dafyomi.co.il/sotah/insites/so-dt-021.htm1) THE PROTECTIVE QUALITIES OF LEARNING TORAH AND PERFORMING MITZVOSQUESTION: The Beraisa explains that the merit of a Mitzvah is compared to candlelight, and the merit of learning Torah is compared to daylight. Just as candlelight provides only a temporary protection from the dangers of the dark, a Mitzvah protects a person only temporarily. The merit of learning Torah, on the other hand, is like daylight; just as daylight is a permanent form of protection (for the sun consistently rises each day), the Torah is a permanent form of protection for a person.
In the Gemara's conclusion, Rava explains that both Torah and Mitzvos protect a person from Yisurin, physical afflictions in this world, both during the time he is involved in them (learning Torah or performing a Mitzvah) and afterwards. The Torah has the additional property that during the time a person is learning, it also protects him from the Yetzer ha'Ra (that is, it affords spiritual protection as well as physical protection).
The Gemara's conclusion seems to contradict the statement of the Beraisa. The Beraisa says that the difference between the merit of Torah and the merit of a Mitzvah is that the merit of Torah provides a more permanent form of protection. According to Rava, however, both the Torah and a Mitzvah offer protection from Yisurin even when a person is not involved with them. Only with regard to protection from the Yetzer ha'Ra do the two differ: a Mitzvah does not provide any protection, while the Torah does.
With regard to what form of danger does the Beraisa state that a Mitzvah provides protection but its protection is less than that provided by the Torah? (TOSFOS DH Mitzvah)
ANSWERS:
(a) The MAHARSHA answers that a Mitzvah's protection exists only in Olam ha'Zeh, this world. The Torah, in contrast, provides protection for the Neshamah even after the person leaves this world. It protects the Neshamah from the Yisurin of Din, judgement, in Olam ha'Ba. (See Chagigah 27a: "The fire of Gehinom has no power over those who learn Torah"; see also Chagigah 15b, and RASHASH and NETZIV here.) In this sense the protection of the Torah is more permanent than the protection of a Mitzvah.
TOSFOS, however, does not accept this answer, perhaps because the Beraisa continues and says that there is another explanation for the difference between Torah and Mitzvos -- that sin can extinguish the merit of a Mitzvah (l'Asid la'Vo; see Rashi and Tosfos) but it cannot extinguish the merit of Torah. What does the Beraisa mean when it says that a sin can extinguish a Mitzvah? If a person performs a Mitzvah, how can he lose reward for it by doing an Aveirah? The Beraisa must mean that the reward of the Mitzvah cannot overpower the necessity for punishment for the Aveirah. Consequently, the person will be punished for the Aveirah despite the fact that he did a Mitzvah. With regard to Torah, however, the Torah he learned will protect him to some extent from punishment for his Aveiros. Since the "Davar Acher" of the Beraisa expresses this difference between Torah and Mitzvos, this cannot be the difference expressed by the first part of the Beraisa. Perhaps the Maharsha understands that the "Davar Acher" indeed expresses the same idea as the first part of the Beraisa but merely in different terms. (Tosfos considered this interpretation improbable and thus did not accept it.)