Unix questions - stripping a unix executable doesn't make it faster

This is Interesting: Free IT Magazines  
Home > Archive > Unix questions > September 2006 > stripping a unix executable doesn't make it faster





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author stripping a unix executable doesn't make it faster
Mark

2006-09-16, 1:43 pm


Is it true that whether you strip an executable or not
under UNIX won't affect it run-time speed much because
unix skips loading the symbols?

At work I was noticing we weren't stripping a program
we compile with g++ 3.x, I then tried strip and the
a.out size went down by a factor of 5x. I assumed that
the OS loads the whole thing in memory so that the
stripped version would be faster since the CPU would
be able to fit more active set into the cache in
place of those unused symbols.

I then ran both and ps showed them using the same
amount of RAM, further googling found some people
saying stripping doesn't help the run speed because
the os doesn't load the symbols but skips them. This
makes a lot of sense to me but I want to confirm it.

Mark
Doug McIntyre

2006-09-16, 1:43 pm

Mark <spamrs_goodbye@x.none> writes:
>Is it true that whether you strip an executable or not
>under UNIX won't affect it run-time speed much because
>unix skips loading the symbols?


stripping an executable won't make one bit of difference other than
you'll use slightly less disk space.

The OS will only page in the parts of the executable that are needed,
and the debugging symbol table won't be needed for normal run-time.

So, its not even a matter of "skiping" the table, but not even
processing it or mapping it in at all.

Rich Gibbs

2006-09-16, 7:38 pm

Mark said the following, on 09/16/06 11:13:
> Is it true that whether you strip an executable or not
> under UNIX won't affect it run-time speed much because
> unix skips loading the symbols?
>
> At work I was noticing we weren't stripping a program
> we compile with g++ 3.x, I then tried strip and the
> a.out size went down by a factor of 5x. I assumed that
> the OS loads the whole thing in memory so that the
> stripped version would be faster since the CPU would
> be able to fit more active set into the cache in
> place of those unused symbols.
>

[snip]

In most, if not all, modern versions of Unix / Linux, virtual memory is
demand paged. So it's quite possible that significant parts of the
executable image will never be loaded into memory, because they are
never accessed.

If you think about what the symbol table is used for (debugging), what
it needs to provide is a mapping from symbol->address. So if you're not
debugging, or otherwise using the table, it should have little to no
effect on performance. The only real cost is a bigger executable file.


--
Rich Gibbs
richg74@gmail.com
"You can observe a lot by watching." -- Yogi Berra

Casper H.S. Dik

2006-09-17, 1:23 pm

Rich Gibbs <richg74@REMOVEgmailCAPS.com> writes:

>In most, if not all, modern versions of Unix / Linux, virtual memory is
>demand paged. So it's quite possible that significant parts of the
>executable image will never be loaded into memory, because they are
>never accessed.


The symbol table is typically not marked as a :loadable section" and
it's therefor *completely* ignored. The only possible speed gain
is skipping the few instructions which normally decide that the symbol
table is not loadable.

Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com