On 2011/05/18 18:06, Niklas Nebel wrote: > Generally, this is a very valid concern. In some places where we found out (or just assumed) that it makes a difference, we currently use smaller integer types directly for member variables, instead of enum. For example, see eCellType in ScBaseCell (sc/inc/cell.hxx). Or FormulaToken (formula/inc/formula/token.hxx), where the type of eOp and eType even depends on DBG_UTIL.
formula/inc/formula/opcode.hxx enum OpCodeEnum { ... }; #ifndef DBG_UTIL // save memory since compilers tend to int an enum typedef USHORT OpCode; #else // have enum names in debugger typedef OpCodeEnum OpCode; #endif That is a great idea!!! > I don't know if Font objects are constructed in very large numbers. That might not be a big concern than that of calc, I think. The font object tends to share the same instance using a reference counter. When a small change such as a font size is being made, the entire object will be duplicated first and then the change is applied to the new instance. I have just tried to determine how __attribute__((packed)) works. https://bitbucket.org/tora/ooo-enum-attribute-packed-experiment-ooo330_m20-vcl/changeset/6f5ec89f0a56 https://bitbucket.org/tora/ooo-enum-attribute-packed-experiment-ooo330_m20-vcl/changeset/110df3d51a23 gcc (GCC) 4.2.3 running CentOS release 5.4 (Final) With the original source code of OOO330_m20 aka OpenOffice.org 3.3.0 sizeof(Impl_Font) = 88 sizeof(FontFamily) = 4 With patch applied source code sizeof(Impl_Font) = 56 sizeof(FontFamily) = 1 That works well so far. But, unfortunately, __attribute__((packed)) seems relatively new. The motivation of this topic comes from a different point. I have been looking for a way to prevent a well-known phenomenon "A single sheet that fits in a A4 paper with Excel turns into two or four A4 papers with Calc." Tweaking nPPTX and nPPTY ? Reducing a font size just before calling OutputDevice::SetFont() from the inside of sc and editeng ? Best regards, Tora -- ----------------------------------------------------------------- To unsubscribe send email to dev-unsubscr...@openoffice.org For additional commands send email to sy...@openoffice.org with Subject: help