Squeezing more out of OpenOffice.org

841 views
736 views

Published on

A huge improvement(46%) of startup performance has been seen with the OpenOffice.org 3.2 released, however there is still one method to squeeze more : merge libraries.

In this session, we'll analysis the principle of this method, use low level IO tools to watch the different behavior, share the detail implementation to remove obstacle, and finally get another 15% improvement of cold startup performance for OpenOffice.org.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
841
On SlideShare
0
From Embeds
0
Number of Embeds
11
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Squeezing more out of OpenOffice.org

  1. 1. Cold startup performance: squeezing more out of OpenOffice.org 3.2 Cheng Yuan Lotus Symphony Performance team, IBM
  2. 2. Agenda <ul><li>OO3.2 improvements
  3. 3. PE file format and dll loading
  4. 4. Merge libraries: result
  5. 5. Further discussion </li></ul>
  6. 6. Startup performance improvements in OO3.2 <ul><li>http://www.openoffice.org/dev_docs/features/3. 2/#gen eral_speed
  7. 7. Cold startup performance improvement a lot (46%) in OO3.2 by : </li><ul><li>Flat placement of libraries
  8. 8. Not rebase
  9. 9. Other optimization </li></ul><li>Want to squeeze more? </li><ul><li>Merge libraries </li></ul></ul>
  10. 10. Merge libraries - fallacy <ul><li>Merge cause bigger libraries, which slow down the loading time
  11. 11. Merge small libraries vs split big libraries? </li><ul><li>The number of the libraries loaded in startup is the key, not the total size (because of on demand loading) </li></ul></ul>
  12. 12. Agenda <ul><li>OO3.2 improvements
  13. 13. PE file format and dll loading
  14. 14. Merge libraries: result
  15. 15. Further discussion </li></ul>
  16. 16. 1 - PE file format <ul><li>MS-DOS header (read in memory)
  17. 17. PE header (read in memory)
  18. 18. Section table (read in memory)
  19. 19. .text: code (map to memory space, pre-fetch several pages)
  20. 20. .data (map to memory space, pre-fetch several pages)
  21. 21. .idata: Imports section( IAT/INT )(read in memory)
  22. 22. .edata: Exports section( EAT/ENT ) (read in memory) </li></ul>
  23. 23. 2 - OS loader to load a Dll <ul><li>Open the dll file;
  24. 24. Read MS-DOS header/PE header/section table into memory
  25. 25. Map .text / .data to memory space, pre-fetch some pages of these 2 sectoins.
  26. 26. Read .idata into memory </li><ul><li>Search the import dlls, load it( including read .idata/.edata of them ) </li></ul><li>Run DllMain, and other callback. </li></ul>
  27. 27. 3 - When 2 dlls are merged into 1 <ul><li>Reduce time of </li><ul><li>Open 2 files -> open 1 file, reduce IO.
  28. 28. Read 2 times of MS-DOS header/PE header/section table into memory -> read 1 time : reduce disk seek time and IO.
  29. 29. Read 2 times of .idata/.edata section into memory -> read 1 time : reduce disk seek time, part of 2 .idata may be merged : reduce IO.
  30. 30. Other OS loader overhead. </li></ul><li>MS office XP startup only involve 3 dlls. </li></ul>
  31. 31. Agenda <ul><li>OO3.2 improvements
  32. 32. PE file format and dll loading
  33. 33. Merge libraries: result
  34. 34. Further discussion </li></ul>
  35. 35. Merged libraries list
  36. 36. Result on OO1.1/Symphony 1.x Merge count : 65 libraries => merged into 10 libraries. Libraries loaded in startup : before merge 68 => after 24 FAT32: NTFS: ThinkPad T41 P1.6G 768M Windows XP 'soffice.exe -writer' to start writer.
  37. 37. Detail implementation Merge : DLL1 + DLL2 = DLL2 1)Modify makefile of DLL1: don't generate DLL1; instead generate a static lib for it. 2)Modify d.lst of DLL1, deliver the static lib into solver. 3)Modify makefile of DLL2: make the static lib of DLL1 as a input of DLL2.. 4)Add export function name list of DLL1 into DLL2's list. 5)Modify all makefiles of modules which depend on DLL1, change the dependency from DLL1 import lib to DLL2 import lib. 6)Modify build.lst of DLL2: making DLL1 module get built before DLL2 module start build. 7)If DLL1 and DLL2 have global functions/variables which share same name, modify them. 8)If resource ID of DLL1 and DLL2 conflict, modify them. 9)If DLL1 and DLL2 are UNO component DLLs, need to modify the implementation code of UNO factory. 10) Modify scp, making DLL1 will not be installed.
  38. 38. Merge guideline <ul><li>Build dependency
  39. 39. Not have to merge the source code directories
  40. 40. Merge dlls in different modules or same module.
  41. 41. UNO libraries
  42. 42. Startup sequence
  43. 43. Logic relationship </li></ul>
  44. 44. Agenda <ul><li>OO3.2 improvements
  45. 45. PE file format and dll loading
  46. 46. Merge libraries: result
  47. 47. Further discussion </li></ul>
  48. 48. Further improvement on cold startup <ul><li>Comparing to MS office XP
  49. 49. Free Discussion </li></ul>Cold startup time Time (seconds) IO size (MB) MS office XP 2.8 1.5 Merged OO1.1 12.5 10.9
  50. 50. THANKS

×