|
size: cppuhelper containers ... ~700k: msg#00151openoffice.devel.general
Hi there, So - in my ongoing campaign to shrink memory usage, it seems that the cppuhelper classes use the (uber-stupid) stl::hash_map code that insists on allocating a staggering amount of memory for an empty hash (as previously discussed). Dumping counts of OMultiTypeInterfaceContainerHelper and it's Int32 variant extant post writer startup I see: IfContainers 507 IfContainersInt32 388 I also notice that wrt. the contents of the m_pMap we normally have very few elements: count num elements 282 1 2841 2 1569 3 38 4 That is for IfContainers, and -incredibly- none of the IfContainersInt32 actually have any contents at all ;-) [ I have to load an impress document to get even a few of them with 1-2 items in them ]. A hash_map's default size is 193 elements, so we waste: (507+388) * (193 - 4) * 4-bytes-per-ptr = 676Kb The patch: http://go-oo.org/ooo-build/patches/src680/size-cppuhelper.diff switches from a hash to a vector, which given the size saving, and small data sets, will almost certainly accelerate things however you look at it, and saves a chunk of RAM. The saving is around 700k by not allocating the (~all empty) Int32 container contents too, numbers from pmap (DIRTY): Before: 19264 19256 + 19268 + 3 / p : 19262 After: 18552 18552 + 18544 + 3 / p : 18549 Saving: - p : 713(k) "using STL hash may unexpectedly bloat your world" :-] This does of course change some cross-module API - wrt. the inlines in interfacecontainer.hxx - but I believe this is no longer a big concern (?). Thanks, Michael. -- michael.meeks@xxxxxxxxxx <><, Pseudo Engineer, itinerant idiot |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: In the Works: New OOo C++ Coding Standards: 00151, Jan Holesovsky |
|---|---|
| Next by Date: | LinuxIntelEnv.Set.sh -> LinuxX86Env.Set.sh: 00151, Jan Holesovsky |
| Previous by Thread: | OO 2.1 with jre 1.6 - xml validation problemi: 00151, Oliver Brinzing |
| Next by Thread: | Re: size: cppuhelper containers ... ~700k: 00151, Caolan McNamara |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |