Sometimes I feel like I didn't get 40 hours "worth" of productivity after a week, and it didn't make sense to physically spend 40 hours working that week. Is it possible to succeed as a software engineer working less than the traditional 40 hours? I imagine it requires being able to get the work done faster - What are some techniques to do that?
The answer is "yes", but there's many caveats here. The 2 broad axes are:
I was able to work a little less than 40 hours a week at Meta after covid hit and still do well, and I mostly worked a good amount less than 40 hours a week back at Robinhood as a tech lead and also did well. I'll break that down more below, primarily in the skills section. The caveat with the skills is that they're more applicable for senior engineers, but I think the overall mentality is still relevant at any level.
Alex already answered this really well. I will just add one extra point
You need to take a step back and better define what you mean by "do well". If the goal is to get good ratings and become a productive, reliable engineer on the team, absolutely (especially in a health working environment)
If your ambition is to learn as much as you can, quickly become a domain expert in some area and establish yourself as the expert of several areas, then no.
Be honest with your ambitions and choose accordingly.