NetBSD runtime linker gains negative symbol cache

February 27, 2010 posted by Roy Marples

The NetBSD runtime linker now has a negative symbol cache. In a nutshell, this has reduced the startup time of the Evolution mail client from around 5 minutes to 3 seconds on my QuadCore amd64 machine. Not many applications have a lot of plugins with a large amount of links to external libraries and I doubt many other applications will gain such a drastic speed bump, but the GNOME desktop as a whole now loads small bit quicker. I would imagine that KDE will now load faster as well.




what is a negative symbol cache? How does this compare to the prelink efforts that happened when dynamic linking was first introduced as standard?

Posted by on February 27, 2010 at 08:00 PM UTC #

Same question here! Please explain!

Posted by rob on February 27, 2010 at 11:11 PM UTC #

negative symbol cache means remembering which symbols were asked for and not found, so that you don't need to look for them again.. ?

Posted by on March 01, 2010 at 09:12 AM UTC #

Although I described it as a negative symbol cache, it's more of a negative library cache. I used symbol because the affected system call is dlsym(3). For example, looking up symbol "foo" in library a, when a needs b and c, b needs c and c needs d, the old code looked in library a, b, c, b, c, c, d. The new code looks in a, b, c, d. Of course, it's a little more complicated than that, but it's the general idea.

Posted by Roy Marples on March 01, 2010 at 09:51 AM UTC #

Out of curiosity, how are the other BSDs doing it and how is linux doing it? Is this something unique for NetBSD?

Posted by on March 03, 2010 at 06:21 AM UTC #

For anyone that's interested, the actual change is this: I haven't looked at the code, so I have a question: based on the above example, if the program looks up "foo" twice, does the second lookup still look in a,b,c,d? (ugh, btw the formatting here sucks! It's not possible to even insert line breaks)

Posted by Eric on March 03, 2010 at 04:20 PM UTC #

I took the basic idea from FreeBSD, but improved the performance drastically. Basically, the huge win is by caching both breadth and depth of the needed/weak symbol lookup. Easiest to think of a,b,c,d as a matrix and FreeBSD just cache a row where we cache both rows and columns.

Posted by Roy Marples on March 04, 2010 at 07:27 PM UTC #

Very cool, anyone got benchmark on this? I'm wondering how Firefox/OO.o startup times changed. :-)

Posted by ahoka on March 10, 2010 at 08:43 AM UTC #

Post a Comment:
Comments are closed for this entry.