If anyone has ever told you that you can "sleep when you're dead" they are either joking (at least I hope) or they have no idea what they are talking about.
There are two angles to come at this from... firstly, daily rest (primarily sleep), and secondly the more macro (long-term) rest, like finding balance or taking time away from work to avoid burnout.
If you get 5 hours of sleep instead of 7, how much more do you think you'll get done?
In the short term it might be a lot, but in my opinion, it will never last.
The likelihood is you'll either have to take more breaks from work, or procrastinate more, because you're tired.
Either that or it will catch up with you to the point that you'll need a long lie-in or a day off to rest.
Alternatively, you could avoid this, do a similar amount of total work, and have consistent adequate sleep.
You will also (110%!!!!!) perform better in the hours that you are awake if you rest properly - whilst maintaining better health.
When it comes to the long-term balance, it's all about being self-aware. You have to be your own best expert.
Check-in and ask yourself, "How long can this last?".
You won't always get this right, and it takes experience to know how much you've truly got left in the tank.
For example: In my first two years of university, I found that I consistently lost momentum in February (after January exams) and had to chase my tail the rest of the year.
The third time around I knew this, so took a week or two fully off the moment my exams finished to completely refresh, then kicked on again - and the difference was enormous, I just needed some rest.
At the end of the day, the only way to find your limits is to push them, and with this comes mistakes and burnouts...
But that's just part of the process.