Because memory controller prefetch memory blocks, execution time of functions calls sequence depend on order this functions in memory. For example: 4 calls:
call func1 call func2 call func3 call func4 faster in case of direct functions order in memmory: .p2align 4 func1: ret .p2align 4 func2: ret .p2align 4 func3: ret .p2align 4 func4: ret and slow in case inverse order: .p2align 4 func4: ret .p2align 4 func3: ret .p2align 4 func2: ret .p2align 4 func1: ret Unfortunately, inverse order is typical for C/C++. what do you think about this kind optimization? -- Summary: Optimization by functios reordering. Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vvv at ru dot ru http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40093