Friday, December 21, 2007

OOo startup speedups

Recently I was working on removal of some libraries from the OpenOffice.org startup procedure. They are not needed immediatiely during the startup, and can be loaded later when the user decides to use the functionality, or they are not needed at all any more. It saves disk access and linking time; I measured the win of the changes described below (on an AMD Geode based system, 'simulated cold start' using sync ; echo 3 > /proc/sys/vm/drop_caches), and it went down to 14.2s from 15.5s in KDE, to 11.5s from 12.7s in Gnome, and to 9.3s from 9.5s in WindowMaker (the win is smaller there because gnome-vfs wasn't used there even before the changes). I believe there is more time to save, and I'll try to find it of course ;-) Now what exactly was there:

gnome-vfs was initialized immediately during startup to avoid a deadlock. It has to be initialized in the thread as the Gtk+ itself; so moving the initialization to the main thread solved the problem, and gnome-vfs was removed from the startup. See issue 84137 for more.

Form controls in an empty document are initilized during startup because they are in 'design mode' (the user is able to create new form controls). This makes sense of course, but before the user creates the first form control, it is not necessary to load libfrm and all its dependencies - lots of users don't need form controls for their documents at all. See issue 84259 for more.

First start wizard is presented to the user during the first start of OOo to offer registration and migration of the settings from the previous version of OOo. Unfortunately, library that does this is loaded every time the OOo is started - just to check that there's nothing to do. See issue 84169.

localedata_es is a dependency of localedata_euro just because of one entry that can be easily moved to localedata_es itself. Very cheap win ;-), see issue 84206.

libstartup-notification was removed, because up-stream has never used it, and we (ooo-build) do not use any more either because of the external splash that we are trying to push up-stream for quite some time (another nice win, by the way). See issue 84179.

Another effort in this area is Caolan's great unifysound01 CWS which removes nas, sndfile and portaudio from the VCL dependencies.

One problem here is that we remove some stuff from the startup, and other creeps in. Michael had an idea to introduce a kind of OSL_ASSERT_NOT_BOOSTRAP() macro that would be added to the init functions of the components that for sure should not be in the startup procedure, and check for that in smoketest. I'll try to produce a patch for that shortly as well...

Monday, July 2, 2007

ccache for MSVC

For those building OpenOffice.org on Win32, it might be interesting that I've extended ccache to deal with MSVC. I've done it during our Novell HackWeek; I hope you'll enjoy the result as much as I enjoyed the hacking ;-)

It is easy to use, instead of guw.exe /path/to/cl.exe, you'll use guw.exe ccache.exe /path/to/cl.exe in your CXX environment variable after having sourced the environment. To see the ccache statistic, use ccache -s. You can override the directory where is the cache stored by exporting CCACHE_DIR="c:\where\you\want". Should you find any bugs, please send me patches :-)

I've not measured the speedup too much yet, but it was >20% in vcl compared to non-ccache run, the penalty of the initial fill of the cache was like 17% [compared to non-ccache]. Would be great if someone did a measurement of the entire build.

The patch and the binary are here, some more info there.

Thursday, February 1, 2007

OpenOffice.org git repository

You could have seen already two blog entries about a new SCM for OOo (Is Subversion OOo's next revision control system? (by Nils Fuhrmann) and OpenOffice.org SCM) (by Jens-Heiner Rechtien), who seem to prefer Subversion. But I would rather go the git way, because this could tighten the cooperation between ooo-build and up-stream; namely the features or fixes could be much more easily integrated from ooo-build back to up-stream.

From my point of view:

  • git should be used just for the source code, not for the project WWW pages. I don't care about the tool used for the WWW pages - I think that CVS is perfectly sufficient for them, I don't think it's really necessary to convert them to anything else (no extensive branching there, they change just occasionally, etc.)
  • The OOo code should be split to 2 parts - the source code itself, and the 3rd party code that is just a verbatim or a slightly patched version of free libraries (agg, beanshell, berkeleydb, bitstream_vera_fonts, boost, ..., zlib). The contemporary Linux distros are able to compile without them, using --with-system-libs configure option; on Win32 we could ship a pre-compiled pack - no need to recompile these again and again.

The OpenOffice.org git repository for testing purposes is now available at http://go-oo.org/git/ - feel free to try it. More about the topic is in the OOo Wiki.

Monday, December 18, 2006

OOo 2.1 source archives

OpenOffice.org 2.1 source archives are now split the same way you used to see in ooo-build - to the core part (the only one really needed by the developers), system (libraries that could be already present in the system), binfilter (filters to load/save the old StarOffice formats), l10n (translations to other than English and German), and sdk (Software Development Kit). Additionally the archives are compressed with bzip2 instead of gzip for additional savings.

Big thanks to Joost who made it possible from the up-stream side. ooo-build will start using these archives. We all hope that for the beginning OOo developers the archives are less scary now - 117MB to download instead of the former 300MB...

Thursday, November 2, 2006

A a = A( b ) in C++

If you ever get involved in an argument whether A a = A( b ); is or is not equivalent to A a( b ); in C++ (like me yesterday ;-) ), the answer is "it depends". Eg. g++ has a switch for that, see the man page: -fno-elide-constructors: The C++ standard allows an implementation to omit creating a temporary which is only used to initialize another object of the same type. Specifying this option disables that optimization, and forces G++ to call the copy constructor in all cases.

So - in g++ by default it really means A a( b );, but it could also mean a copy construction from temporary [something like A a( A( b ) ); which you cannot really use unless b is a constant, eg. 3, or "blah" - would mean a declaration of a function named a otherwise] with -fno-elide-constructors. Try it yourself...

Monday, October 2, 2006

OpenOffice.org and SVG import

You know what is SVG, don't you? ;-) If not - it means Scalable Vector Graphics, and it is a vector graphics format that describes 2D graphics in XML.

So far, there's no native SVG import filter for OOo. There exists an external one, but unfortunately it has very strong dependencies - Java 5.0, and Batik.

I am currently working on another implementation. It is in C++, using the UNO Draw API, and a lighweight libsvg library. libsvg is just a parser - which is exactly what I need; unfortunately it does not seem to be too actively maintained :-( If you know about a better choice - just drop me a mail to kendy at openoffice.org. Thanks!

If you are interested in the current progress: I can import rectangles and circles, extension to other shapes is easy. I have problems with transformations - some of them work, some do not; to be improved. If you are interested in pictures, try this snowman, and have a look how it should look like, and how it currently looks in draw. If you are interested in source code, a snapshot is here.