O'Reilly logo

Mathematics and Physics for Programmers, Second Edition by Danny Kodicek, John Patrick Flynt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 22. Speeding Things Up

Overview

Throughout this book, the emphasis has been on the mathematics and physics behind the code, and I’ve been stressing the fact that all code examples could be made to run faster by sensible optimizations. This chapter is the only one in which you’ll be examining optimization. It offers techniques for speeding up your code by the use of pre-calculated values and segregation of space.

Cheap and Expensive Calculations

The principal key to speedy code is an understanding of which kinds of calculations are computationally cheap and which are more expensive. Cheap refers to code that takes few computer cycles. Expensive refers to code that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required