Can the brain work better in stressful conditions?
A little stress is good, as it leads to greater psychological arousal, but lots of stress will decrease performance. This is known as the Yerkes–Dodson law, from the famous experiment by Yerkes and Dodson (1908) which related strength of motivational electric shocks to performance; performance increased up to a point and then plummeted.

One more comment about something you said:


  For example; if you know that you are about to die because your house is on fire, the brain will perceive everything more quickly than normal.


People do report subjective time dilation for scary events but quantitative attempts have found no evidence for such, see Stetson et. al. (2007).

References

Stetson, Chess, Matthew P. Fiesta, and David M. Eagleman. "Does time really slow down during a frightening event?." PLoS One 2.12 (2007): e1295.

Yerkes RM, Dodson JD (1908). "The relation of strength of stimulus to rapidity of habit-formation". Journal of Comparative Neurology and Psychology 18: 459–482.