Chapter 3. Conquering Efficiency

It’s action time! In Chapter 1, we learned that software efficiency matters. In Chapter 2, we studied the Go programming language—its basics and advanced features. Next, we discussed Go’s capabilities of being easy to read and write. Finally, we mentioned that it could also be an effective language for writing efficient code.

Undoubtedly, achieving better efficiency in your program does not come without work. In some cases, the functionality you try to improve is already well optimized, so further optimization without system redesign might take a lot of time and only make a marginal difference. However, there might be other cases where the current implementation is heavily inefficient. Removing instances of wasted work can improve the program’s efficiency in only a few hours of developer time. The true skill here as an engineer is to know, ideally after a short amount of research, which situation you are currently in:

  • Do you need to improve anything on the performance side?

  • If yes, is there a potential for the removal of wasted cycles?

  • How much work is needed to reduce the latency of function X?

  • Are there any suspicious overallocations?

  • Should you stop overusing network bandwidth and sacrifice memory space instead?

This chapter will teach you the tools and methodologies to help you answer these questions effectively.

If you are struggling with these skills, don’t worry! It’s normal. The efficiency topic is not trivial. Despite the demand, ...

Get Efficient Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.