It usually takes more than three weeks to prepare a good impromptu speech. -- Mark Twain
Writing, when done well, takes time. Some journalists write to a certain length and then shorten to improve quality. A similar process occurs when programming. A scaffolding is required and the final program is smaller. Unfortunately, this process of honing is greatly undervalued and often skipped. It takes significant time and creates less impressive statistics when you've finished. Regardless, the reduced volume of code will be create a long-term saving.
Here's a hypothetical example of what often happens to me:
1. Have a problem, need a module, copy a template: 100 LOC.
2. Add meat to the bones: 500 LOC.
3. Start testing & find gaps: 700 LOC.
4. Keep testing until it works (almost) perfectly: 1000 LOC.
5. Refactor, rename variables, tighten comments, pull common objects, strip out what was never really needed: 300 LOC.
A lot of work to get to 300 LOC, but I couldn't have done it without writing 1000 LOC in the first place. How do I measure that?