Merge UNO Dlls
The table shows the dlls statistics in my OpenOffice.org 3.0 zh_CN version product suite.
Another table shows how many dlls loaded during starting a swriter module with a blank odt file.
From the statistics we can see, too many small dlls loaded at startup, and this cause too much redundant I/O(see http://msdn.microsoft.com/en-us/magazine/bb985014.aspx). So, merging some small dlls into bigger one will reduce I/O time.
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:
There are more than 130 UNO dlls in OpenOffice.org product suite, and most of them are small.
How to merge?
Merging UNO dlls is easy, because:
- simple and few export functions
- there is no direct dependence from each other
- 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):
- 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.
- 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
- 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.
- 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
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.