Problem: 1306625

Title: (Performance) Use PowerPC Struct alignment

Received: Dec 5 1995 10:18AM


I'm not exactly sure who is working on MacApp any more, but I thought it would be useful for you to know that you're leaving a potentially very good optimization OFF when you compile MacApp 3.3.

I work on the Copland Finder and one of the things I've been doing lately is making sure that we can compile using PowerPC struct alignment. At performance sessions given at last year's WWDC, Bruce Jones and Eric Traut mentioned the benefits of properly aligning all data structures for PowerPC -- the end result can be often be as much as a 2X speed increase.

Basically, you need to wrap all struct definitions with the following ONLY if the struct is passed to or received from the Mac toolbox, or is read as a resource from disk (and the struct is created to easily access the fields).

Otherwise, leave POWERPC alignment ON.

#if GENERATINGPOWERPC
#pragma align=mac68k
#endif
 
struct
{
  // define my 68K aligned struct here
  // which is either read-from-disk as a resource or
  // is a data structure passed to the toolbox
}
 
#if GENERATINGPOWERPC
#pragma align=reset
#endif

Fix:

Fixed it for CW MPW builds and MrC.