LWN.net Logo

All hail the speed demons (O'Reillynet)

All hail the speed demons (O'Reillynet)

Posted Nov 2, 2005 20:04 UTC (Wed) by alq666 (guest, #11220)
Parent article: All hail the speed demons (O'Reillynet)

I must strongly disagree with the comparison of optimization and black-art. This type of mindset is
one of the reasons why a lot of software is really not so good, open-source or closed-source.
Optimization requires rigour, tools and a good deal of analysis before any modification is made to
the code.

For instance stripping .comment out of the binaries strikes me as a shot in the dark; I'm not sure
whether mapping an extra 400k in memory is such a huge performance hit...


(Log in to post comments)

All hail the speed demons (O'Reillynet)

Posted Nov 2, 2005 21:35 UTC (Wed) by darthmdh (guest, #8032) [Link]

For instance stripping .comment out of the binaries strikes me as a shot in the dark; I'm not sure whether mapping an extra 400k in memory is such a huge performance hit...

When you have 20-odd shared libraries linked in with every application, that 400k soon becomes 8Mb. Even if it was, all-up, 400k - what happens if that 400k of useless cruft then pushes the required memory over a page boundary? And the new required page due to memory pressure requires paging something else to disk?

You may call this nit-picking but there's a variety of applications where there is substantial memory pressure (think so-called embedded devices like mobile phones, pda's and network appliances) where 8Mb can be 25% (or more) of your RAM.

All hail the speed demons (O'Reillynet)

Posted Nov 2, 2005 22:59 UTC (Wed) by proski (subscriber, #104) [Link]

My interpretation of "Saved 400k over all OO.o libraries by stripping the .comment sections" is that it was a total number for all the OO.o libraries together. I don't think most of those libraries are used in the same time, and it's hard to imagine what it would take to occupy 8M with .comment sections, considering that most applications (even Mozilla) use much fewer libraries that OO.o.

All hail the speed demons (O'Reillynet)

Posted Nov 3, 2005 1:30 UTC (Thu) by clugstj (subscriber, #4020) [Link]

The .comment section is never loaded into memory so the only savings in this case is disk storage space.

All hail the speed demons (O'Reillynet)

Posted Nov 3, 2005 12:20 UTC (Thu) by ekj (subscriber, #1524) [Link]

Not quite.

First you save disk-space since the binaries gets smaller.

Secondly your program starts quicker since there is less data to read (even if they're not loaded, they're still read, and even if they're not read, then there's an extra seek to skip them, and even then the VFS migth decide to do readahead anyway and thus physically read and transfer to RAM parts of the file which your application never ever touches or reads.

OK, so it's probably not major. But it wouldn't surprise me if the measured speedup was quite measurable.

All hail the speed demons (O'Reillynet)

Posted Nov 4, 2005 13:28 UTC (Fri) by nix (subscriber, #2304) [Link]

Sections which are not loaded are not read except if they happen to be in the same page as the loaded sections. You can ignore them except for their disk space consumption.

All hail the speed demons (O'Reillynet)

Posted Nov 7, 2005 15:35 UTC (Mon) by lypanov (subscriber, #8858) [Link]

umm you realize that disks are laid out in fairly large tracks
rather than 4kb sections right?

All hail the speed demons (O'Reillynet)

Posted Nov 7, 2005 23:37 UTC (Mon) by nix (subscriber, #2304) [Link]

Yes. Even so, that large chunk containing a LOADed section would be read *whether or not the other parts of it happen to be LOADed or not*, so, again, the worst that .comment does is to reduce packing efficiency of LOADed sections. This is hardly a killer --- given that we have no effective tools to improve locality of reference in shared libraries anyway, we're wasting far more disk accesses on unnecessary paging due to poor packing of accessed functions.

Copyright © 2012, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds