Behind the scenes
A critical part of writing fast code is to understand what happens behind the scenes. Are you appending strings? You should know how that is implemented in a compiler. Passing a dynamic array into a function? Ditto. Wondering whether you should create 10,000 instances of a class or just create a large array of records? Knowing the implementation details will give you the answer.
In this section, I’ll dig down into some frequently used data types and show how using them will bring in unexpected complexity. I will discuss memory and memory allocation, but I will treat them as very abstract entities. I’ll use phrases such as, “A new string gets allocated,” which means that a secret part of code, called the memory manager, gets memory from Windows and tells the program, “You can store your string here.” We’ll dig deep into the bowels of memory manager in Chapter 6, Memory Management.
A plethora of types
The Delphi...