Operating System - HP-UX
1753325 Members
5443 Online
108792 Solutions
New Discussion юеВ

program too slow to load and link 64bit shared library

 
SOLVED
Go to solution

program too slow to load and link 64bit shared library

Hi,

I am deciding whether to make my apps 64-bit or 32-bit.

My app process links a lot of quite big shared libraries, 43 of them reaching 650Mb.

When executing, for a same program, 64-bit version takes about 120 secs in user-mode while 32-bit version takes 10 secs also in user-mode.

The program I used:
#include
using namespace std;
int main(){
cout << "start..and it's end" << endl;
return 0;
}

Surely it doesn't need any of the shared libraries but I just "-l" them when linking.

Would anyone tell me what could be the reason?

Thanks in Advance,
Takeshi Sato
takeshi
9 REPLIES 9

Re: program too slow to load and link 64bit shared library

Sorry, I should have attached the details.

OS:HP-UX 11
PHSS_24303 applied.
aCC.03.31.
takeshi
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: program too slow to load and link 64bit shared library

Something is very wrong. I compiled yor code (although on 11.11) and it executes essentially instantly (certainly in well under a second and it's linked as a 64-bit executable).

If I were you, I would do a swremove of aCC and then a fresh install followed by cumulative patches.

The decision to use 64-bit or 32-bit should be based upon the libraries that are available for your applications and for the size of needed data structures. The advantage of 64-bit code is really in the removal of size limits from data; 32-bit code will actually execute faster in almost every case.
If it ain't broke, I can fix that.

Re: program too slow to load and link 64bit shared library

Thanks Cray.

Some thing to make clear:
The program I coded above is just for this test of linker performance.
Usually my app make full use of the 43 libs of 650MB. But when I conducted a performance tests it resulted that 64-bit version was unusally slow so I coded above.

Actually I just now tested it
on HP-UX 11.11 and it behaves exactly the same.

Although the size of shared libs linked b/w 32 and 64-bit app is about the same(650mb), when it comes to executing,

32) wait for about 1 sec, shows "start...and it's end",
and ends immediately after that.

64) wait for about 10 sec, shows "start...and it's end",
and ends immediately after that.

Would there be any particular difference in behaviour between of 64bit linker (which I guess is : /usr/lib/pa20_64/dld.sl) that makes it at disadvantage when linking a lot of big libraries?

Any, any suggestion I will sincerely appreciate.

Thanks in advance, Tak
takeshi
Mike Stroyan
Honored Contributor

Re: program too slow to load and link 64bit shared library

I don't know of any performance disadvantage to 64 bit shared libraries. There is a difference in the 64-bit link of an a.out. The default for 32 bit exports only used symbols from an a.out. The default for 64-bit exports all symbols from an a.out. That could have some effect on startup time if an a.out has pulled in many symbols that are not truely used.
There are many options that could improve startup time for both 32-bit and 64-bit libraries. The startup time for shared libraries comes from a few activies-
1. resolving symbols
2. executing initializer and static object constructor functions
3. paging in the library memory regions needed to run those initial functions

You can use the fastbind command or ld +fb option to completely cache symbol lookup when linking a program. The feature is not very usable because the fastbind command needs to be rerun whenever any of the shared libraries are updated.

You can use the ld +gst option and related attribute options to use a faster global symbol table and precompute the hash keys used to index that table.

You can use the ld -B option to specify symbol lookup behavior. "-B deferred" will usually give the fastest startup because it does not look up as many code symbols. If a run will actually use almost all code symbols at least once, then "-B immediate" could be a little more efficient by looking up the code symbols in a big batch.

Re: program too slow to load and link 64bit shared library

Thank you Mike.

>The default for 32 bit exports only used symbols from an a.out.
>The default for 64-bit exports all symbols from an a.out.

I think that would explain all this pretty much.

Actually we've tried the +fb and -B option, but it didn't have any significant effect.

I will try +gst option but in a mean time, if anyone knows if there is a option that changes the default behaviour described by Mike, I would truely appreciate sharing.

Thanks, Tak
takeshi

Re: program too slow to load and link 64bit shared library

Hi,

Thanks to Mike my app's start up time improved significantly
with +gst option.

Now I guess it's the +gst tuning time....

If any docs showing the guideline, I would appreciate the URL.

Tak
takeshi
Harri Pasanen_1
Advisor

Re: program too slow to load and link 64bit shared library

In what manual is the +gst option explained?

I went through HP-UX Linker and Libraries User's Guide HP 9000 Computers (B2355-90655.pdf), and that did not even mention it?

Re: program too slow to load and link 64bit shared library

The manual I got (b2355-90731.pdf in Japanese)has a section explaining gst options at chapter 8, b/w PBO section and fastbind secion of the manual.

Acutally, most of what is written is also available at man dld.sl.

So you might want to check that out.

Tak
takeshi
Mike Stroyan
Honored Contributor

Re: program too slow to load and link 64bit shared library

There is a discussion of the +gst option in the "HP-UX Linker and Libraries User's Guide" version at-
http://www.docs.hp.com./cgi-bin/otsearch/getfile?id=/hpux/onlinedocs/dev/B2355-90721/linkhelp.html#BGHCJHIH