Scrambler: Dynamic Layout Adaptation
Developers and compiler writers spend significant effort on performance tuning and optimizations. However, the impact of these efforts must be taken with a grain of salt. Prior work has shown that changes to a program's layout—the placement of code and data in memory—can change performance by more than the effect of standard optimization techniques.
This paper presents Scrambler, a system that dynamically changes the layout of programs to improve their performance. Scrambler runs C and C++ programs with a randomized layout, and monitors these programs for evidence of layout-related performance issues. When an issue is detected, Scrambler relocates the offending code to eliminate the layout issue. We evaluate Scrambler on eight SPEC CPU2006 benchmarks, and find that Scrambler can provide speedups as large as 4.6% by fixing layouts that hurt branch predictor performance. These early results are encouraging, and we plan to extend this work to support additional layout-related performance issues in the future.