Cache the document element: now that we have comments in dom,
[kdelibs.git] / kinit / README
blobea52b023575189dd080a3c2364629da8d4bc547e
1 README
3 kdeinit is a process launcher somewhat similar to the 
4 famous init used for booting UNIX.
6 It launches processes by forking and then loading a
7 dynamic library which should contain a 'main(...)'
8 function. 
10 Executive summary
11 =================
13 Using kdeinit to launch KDE applications makes starting
14 a typical KDE applications 2.5 times faster (100ms 
15 instead of 250ms on a P-III 500) It reduces memory 
16 consumption by approx. 350Kb per application.
19 How it works
20 ============
22 kdeinit is linked against all libraries a standard KDE
23 application needs. With this technique starting an
24 application becomes much faster because now only
25 the application itself needs to be linked whereas 
26 otherwise both the application as well as all the libaries
27 it uses need to be linked.
29 Startup Speed
30 =============
32 Starting an application linked against libqt, libkdecore and libkdeui
33 in the conventional way takes approx. 150ms on a Pentium III - 500Mhz. 
34 Starting the same application via kdeinit takes less than 10ms.
36 (application without KApplication constructor, the KApplication 
37 constructor requires an extra 100ms in both cases)
39 Memory Usage
40 ============
42 An application linked against libqt, libkdecore and libkdeui started
43 in the conventional way requires about 498Kb memory. 
44 (average of 10 instances) If the same application is started via
45 kdeinit it requires about 142Kb. A difference of 356Kb (application 
46 without KApplication constructor) 
48 If we take the KApplication constructor into account, an application
49 started in the conventional way takes about 679Kb memory while the same
50 application started via kdeinit requires about 380Kb. Here the difference
51 is somewhat less, 299Kb. This seems to be caused by the fact that the
52 dynamic linker does "lazy linking". We can force the linker to link
53 everything at startup by specifying "LD_BIND_NOW=true". When kdeinit is
54 started with this option on, kdeinit is back to its full efficiency, an
55 application with a KApplication constructor now uses 338Kb of memory.
56 A difference of 341Kb with the normal case.
58 Adapting programs to use kdeinit.
59 ===============================
61 The sourcecode of a program does not require any change to take advantage
62 of kdeinit. Only the makefile requires an adaption, if the Makefile.am of 
63 a normal program looks like this:
65 bin_PROGRAMS = kicker   
66 kicker_LDADD = $(top_builddir)/libkonq/libkonq.la
67 kicker_LDFLAGS = $(all_libraries) $(KDE_RPATH)
69 The following lines need to be added to make a library version useable 
70 by kdeinit:
72 lib_LTLIBRARIES = kicker.la
73 libkicker_la_LIBADD = $(top_builddir)/libkonq/libkonq.la
74 libkicker_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) -module                    
76 Disadvantages
77 =============
79 The process name of applications started via kdeinit is "kdeinit". This problem
80 can be corrected to a degree by changing the application name as shown
81 by 'ps'. However, applications like "killall" will only see "kdeinit" as 
82 process name. To workaround this, use "kdekillall", from kdesdk/scripts,
83 for applications started via kdeinit.