Not gonna be a popular response but few months ago I was really angry at myself because of two diverging realities
1. I think I am a fairly good developer, when I am in a flow state, I can accomplish a huge amount of work in 3-4 hours.
2. I am very rarely in a flow state.
I am always doing something else, watching some videos, reading books or Feedly, hoping around, etc.
Now comes the controversial part, recently I started using Ritalin. About 5 doses each week. There will probably be consequences (I am not sure), but it's magic. I reach a flow state in under 20 minutes and stay this way for 4h or so.
I decided to change my schedule and only work 4h/day because I constantly do a good amount of work.