You have to stay focused.

Some people make a big deal out of looking busy. They are always doing a lot of things. Often, they put in extra hours. No one can say they don’t put in lots of effort. But while giving the effort is great, what really matters is results.
Unless you’re a consultant, employers are probably not paying you by the hour. Instead, like most of us, you are expected to deliver results. Presenting the appearance of being busy does not deliver working code.
Instead, one should endeavor to avoid distractions. This will allow you to focus on the problem at hand. Also, when working on your code, you should work on only one task at a time. Multi-tasking slows everything down as you have to do a lot of mental context switching. The better programmers don’t multi-task.
By increasing your focus and attention, you can get more done. You may even be able to do it in less time.