dsimcha wrote:
== Quote from Walter Bright ([email protected])'s article
Believe it or not, you can do profile guided optimizations with the dmd
profiler and optlink. The profiler will emit a file to be passed to the
linker which will set the layout of functions to minimize paging.

Is that still a relevant optimization?  It probably made sense circa 1995 when
computers had much less memory, but now I would think that binaries are so much
smaller than a typical computer's memory that they almost never get paged out.

I'll add to the other replies, and say that:

1. if your program has rarely used features, those can be grouped together in such a way that they never load into memory, and so are essentially costless.

2. initialization code can be separated from the working loop, such that the init code pages are loaded, run, and discarded, and never need loading again.

3. file systems like to read files sequentially. So if your code is organized so the next code to execute is next on the disk image, it will load faster.

4. strongly coupled functions (functions that call each other a lot) should be next to each other, so they wind up in the same cache.

Reply via email to