All nighters are never really ideal, obviously. You won't be able to think clearly or quickly when it comes to your exam, which could be detrimental to your grade.
However, sometimes (as in your case) it's more important to get all the knowledge you can rather than being able to think straight. If I haven't done much revision the night before an exam, I'll usually prioritise trying to learn as much as possible over sleeping. After all, being able to think quickly isn't going to be of much help if you don't have any knowledge to think about!
Ultimately, you'll have to decide for yourself what is most important for attaining a good grade.
Edit: If you're reading this rather than revising, you've already lost.