Any expected improvements in startup times?

Jeff Sturm jsturm@one-point.com
Mon Feb 23 02:07:00 GMT 2004


On Sun, 22 Feb 2004, Adam Megacz wrote:
> Erik Poupaert <erik.poupaert@skynet.be> writes:
> > But then again, statically linked, the application runs much faster
> > than dynamically linked. Why?
>
> Dynamic linking on most platforms (Darwin/Mach being a notable
> exception) requires writing 'fixups' into the program's memory image
> once loaded, since the address of library routines is not known at
> link time.

Yeah.  Normally library calls are resolved lazily, so they shouldn't be a
big contributor to startup time.  Data relocs are another matter.

Run your program with "LD_DEBUG=symbols" to get some idea what
ld.so has to do at startup.

Per's ideas for shrinking class metadata would likely also improve startup
times.

> Mach/Darwin does these fixups at "install time" (when the binary is
> written to the disk on the target machine), and has a fallback
> mechanism if the fixups become out of date.

You can do the same on GNU/Linux if you have prelink.

Timing an ordinary Java program before prelinking:

[jsturm@suzy jsturm]$ time ./hello
Hello World

real    0m0.125s
user    0m0.100s
sys     0m0.020s

and after:

[jsturm@suzy jsturm]$ time ./hello
Hello World

real    0m0.042s
user    0m0.020s
sys     0m0.020s


Jeff



More information about the Java mailing list