At school, some students are able to pull an all-nighter and pass the exams and they are very proud of this capability. Yes, it is effective in the short term because you squeeze a lot of information within a short time period and brains can quickly interrelate things and pick up very fast.
But our brain would also overload in this case by putting information into our short term memory and forget it quickly after the exam. So it is just a illusion that you can learn very fast just before the exam. The best strategy is to distribute a book of knowledge into a long period of time, say, 3 months for a textbook. Because the knowledge is interrelated, every time you learn something new, you are also reviewing the old stuff. Gradually, you convert the knowledge from short-term memory to long-term.
It is also the logic behind the well-known “forgetting curve” developed by Hermann Ebbinghaus in 1885.