Merge UNO Dlls

From Apache OpenOffice Wiki
Jump to: navigation, search

Dlls statistics

The table shows the dlls statistics in my 3.0 zh_CN version product suite.

size amount
<200K 215
200K<size<500K 64
500K<size<1M 33
1M<size<5M 32
>5M 4

Another table shows how many dlls loaded during starting a swriter module with a blank odt file.

size amount
<200K 49
200K<size<500K 16
500K<size<1M 13
1M<size<5M 11
>5M 4

From the statistics we can see, too many small dlls loaded at startup, and this cause too much redundant I/O(see So, merging some small dlls into bigger one will reduce I/O time.

UNO Dlls

What we say UNO Dlls is the dll which provides UNO service only, so it exports only few same functions according to the UNO architecture(compare to other basic function provider like sal3.dll, it exports a lot of basic functions). That is:

  • component_getImplementationEnvironment
  • component_writeInfo
  • component_getFactory

There are more than 130 UNO dlls in product suite, and most of them are small.

How to merge?

Merging UNO dlls is easy, because:

  1. simple and few export functions
  2. there is no direct dependence from each other
  3. just need few changes of code

All of this are benefit from the factorial create method of UNO service.

How to merge(suppose dll A and dll B merged into a new dll C):

  1. Decide which UNO dlls need to be merged, a simple principle is similar functional and most frequent used UNO dlls need to be merged into one.
  2. Modify A and B's export function name to inner name which like component_getFactoryA in the implementation file, modify the makefile not to build the dll, but libs
  3. Create a new module to build the new dll C which is the new UNO dll, implement the export function in which calls component_getFactoryA and other functions.
  4. Register the new dll C into service.rdb.

We can use some macros to implement the merge conveniently.

Here is a detail design:Easy UNO Services Merging

Experimental Result

We did an experiment of merging 13 UNO Dlls(all together 1.6M) to 1 Dll(after merged 1.2M) and got 5.48% time win during cold start and got 4.87% time win during warm start.

Personal tools