- Mastering Delphi Programming:A Complete Reference Guide
- Primo? Gabrijel?i?
- 156字
- 2021-06-24 12:33:35
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 say words like "A new string gets allocated" with which I'll mean that a secret part of code, called memory manager, gets memory from the Windows and tells the program: "You can store your string here." We'll dig deep into the bowels of memory manager in Chapter 4, Memory Management.